Author: sbruno
Date: Tue May 24 13:57:23 2016
New Revision: 300612
URL: https://svnweb.freebsd.org/changeset/base/300612

Log:
  Reject ioctl commands for FLSHGCHR and FLSHPCHR if the size is greater
  than sc->areq.  This is a bounds check to ensure we're not just cramming
  arbitrarily sized nonsense into the driver and overflowing the heap.
  
  PR:           209545
  Submitted by: ct...@hardenedbsd.org
  MFC after:    2 weeks

Modified:
  head/sys/dev/an/if_an.c

Modified: head/sys/dev/an/if_an.c
==============================================================================
--- head/sys/dev/an/if_an.c     Tue May 24 13:57:23 2016        (r300611)
+++ head/sys/dev/an/if_an.c     Tue May 24 13:57:23 2016        (r300612)
@@ -3749,6 +3749,9 @@ flashcard(struct ifnet *ifp, struct airo
                        return ENOBUFS;
                break;
        case AIROFLSHGCHR:      /* Get char from aux */
+               if (l_ioctl->len > sizeof(sc->areq)) {
+                       return -EINVAL;
+               }
                AN_UNLOCK(sc);
                status = copyin(l_ioctl->data, &sc->areq, l_ioctl->len);
                AN_LOCK(sc);
@@ -3760,6 +3763,9 @@ flashcard(struct ifnet *ifp, struct airo
                else
                        return -1;
        case AIROFLSHPCHR:      /* Send char to card. */
+               if (l_ioctl->len > sizeof(sc->areq)) {
+                       return -EINVAL;
+               }
                AN_UNLOCK(sc);
                status = copyin(l_ioctl->data, &sc->areq, l_ioctl->len);
                AN_LOCK(sc);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to