svn commit: r303177 - stable/10/sys/dev/an

Sean Bruno sbruno at FreeBSD.org
Fri Jul 22 03:26:03 UTC 2016


Author: sbruno
Date: Fri Jul 22 03:26:01 2016
New Revision: 303177
URL: https://svnweb.freebsd.org/changeset/base/303177

Log:
  MFC r300612
  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

Modified:
  stable/10/sys/dev/an/if_an.c

Modified: stable/10/sys/dev/an/if_an.c
==============================================================================
--- stable/10/sys/dev/an/if_an.c	Fri Jul 22 03:21:47 2016	(r303176)
+++ stable/10/sys/dev/an/if_an.c	Fri Jul 22 03:26:01 2016	(r303177)
@@ -3777,6 +3777,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);
@@ -3788,6 +3791,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);


More information about the svn-src-stable mailing list