⬢ DragonFlyBSD Kernel Audit
DF-5702 / build_full.log
← back to finding ↓ download raw
== kernel source identity (guest /usr/src vs repo sys/) ==
3699317468 4185 /usr/src/sys/libkern/strtoq.c
3988050194 3159 /usr/src/sys/libkern/strtouq.c
== generating userland-compilable copies via sed (no hand edits) ==
k_strtoq_fix.c: 1 isxdigit guard site(s) (expect 1)
k_strtouq_fix.c: 1 isxdigit guard site(s) (expect 1)
== diff of fix vs baseline (must be ONLY the guard) ==
--- k_strtoq.c	2026-10-10 07:38:18.187499000 +0000
+++ k_strtoq_fix.c	2026-10-10 07:38:18.197446000 +0000
@@ -41,7 +41,7 @@
  * alphabets and digits are each contiguous.
  */
 quad_t
-k_strtoq(const char *nptr, char **endptr, int base)
+k_strtoq_fix(const char *nptr, char **endptr, int base)
 {
 	const char *s;
 	u_quad_t acc;
@@ -67,7 +67,7 @@
 			c = *s++;
 	}
 	if ((base == 0 || base == 16) &&
-	    c == '0' && (*s == 'x' || *s == 'X')) {
+	    c == '0' && (*s == 'x' || *s == 'X') && isxdigit((unsigned char)s[1])) {
 		c = s[1];
 		s += 2;
 		base = 16;
--- k_strtouq.c	2026-10-10 07:38:18.197446000 +0000
+++ k_strtouq_fix.c	2026-10-10 07:38:18.197446000 +0000
@@ -41,7 +41,7 @@
  * alphabets and digits are each contiguous.
  */
 u_quad_t
-k_strtouq(const char *nptr, char **endptr, int base)
+k_strtouq_fix(const char *nptr, char **endptr, int base)
 {
 	const char *s;
 	u_quad_t acc;
@@ -65,7 +65,7 @@
 			c = *s++;
 	}
 	if ((base == 0 || base == 16) &&
-	    c == '0' && (*s == 'x' || *s == 'X')) {
+	    c == '0' && (*s == 'x' || *s == 'X') && isxdigit((unsigned char)s[1])) {
 		c = s[1];
 		s += 2;
 		base = 16;
== compile ==
build OK: /tmp/df5702/diffharness