[git commit] fixdep: avoid underflow when end of entry doesn't coincide with EOF

Denys Vlasenko vda.linux at googlemail.com
Mon Feb 27 12:09:44 UTC 2023


commit: https://git.busybox.net/busybox/commit/?id=2d4a3d9e6c1493a9520b907e07a41aca90cdfd94
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

Bug: https://bugs.gentoo.org/893776
Closes: https://bugs.busybox.net/show_bug.cgi?id=15326
Signed-off-by: Arsen Arsenović <arsen at gentoo.org>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 scripts/basic/fixdep.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index 426b4888b..66be73aad 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -338,6 +338,11 @@ void parse_dep_file(void *map, size_t len)
 			do p--; while (!isalnum((unsigned char)*p));
 			p++;
 		}
+		if (p < m) {
+			/* we've consumed the last filename of this list
+			   already.  */
+			break;
+		}
 		memcpy(s, m, p-m); s[p-m] = 0;
 		if (strrcmp(s, "include/autoconf.h") &&
 		    strrcmp(s, "arch/um/include/uml-config.h") &&


More information about the busybox-cvs mailing list