Module Name: src
Committed By: christos
Date: Wed Feb 3 05:29:43 UTC 2016
Modified Files:
src/sys/dev: dev_verbose.c
Log Message:
PR/50749: David Binderman: check bounds before dereference.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/dev_verbose.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/dev_verbose.c
diff -u src/sys/dev/dev_verbose.c:1.1 src/sys/dev/dev_verbose.c:1.2
--- src/sys/dev/dev_verbose.c:1.1 Sun Sep 21 10:30:22 2014
+++ src/sys/dev/dev_verbose.c Wed Feb 3 00:29:43 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: dev_verbose.c,v 1.1 2014/09/21 14:30:22 christos Exp $ */
+/* $NetBSD: dev_verbose.c,v 1.2 2016/02/03 05:29:43 christos Exp $ */
/*
* Redistribution and use in source and binary forms, with or without
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dev_verbose.c,v 1.1 2014/09/21 14:30:22 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dev_verbose.c,v 1.2 2016/02/03 05:29:43 christos Exp $");
#include <sys/param.h>
@@ -65,7 +65,7 @@ dev_findvendor(char *buf, size_t len, co
/* Skip Tokens */
n++;
- while (vendors[n] != 0 && n < nvendors)
+ while (n < nvendors && vendors[n] != 0)
n++;
}
snprintf(buf, len, "vendor %4.4x", vendor);
@@ -86,7 +86,7 @@ dev_findproduct(char *buf, size_t len, c
/* Skip Tokens */
n += 2;
- while (products[n] != 0 && n < nproducts)
+ while (n < nproducts && products[n] != 0)
n++;
}
snprintf(buf, len, "product %4.4x", product);