DragonFlyBSD Kernel Audit
DF-0715 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/netproto/smb/smb_subr.c b/sys/netproto/smb/smb_subr.c
--- a/sys/netproto/smb/smb_subr.c
+++ b/sys/netproto/smb/smb_subr.c
@@ -138,7 +138,7 @@
 {
 	char *p;
 
-	if (len > 8 * 1024)
+	if (len <= 0 || len > 8 * 1024)
 		return NULL;
 	p = kmalloc(len, M_SMBSTR, M_WAITOK);
 	if (copyin(umem, p, len) == 0)
@@ -155,7 +155,7 @@
 {
 	char *p;
 
-	if (len > 8 * 1024)
+	if (len <= 0 || len > 8 * 1024)
 		return NULL;
 	p = kmalloc(len, M_SMBSTR, M_WAITOK);
 	bcopy(umem, p, len);