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

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Thu Feb 23 08:28:35 UTC 2023


Hi Arsen!

On Tue, 21 Feb 2023 20:20:31 +0100
Arsen Arsenović <arsen at gentoo.org> wrote:

> 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>
> ---
> Hi,
> 
> This is a fix for the recently reported scandep-related build failure.
> The linked Gentoo bug also includes a write-up explaining how the error
> happens.

I think we lifted fixdep from the kernel, either
linux/scripts/basic/fixdep.c
or
linux/tools/build/fixdep.c

Can you see if we diverged in other ways, too, or if any of the linux
ones suffer from the same problem?

That said, i think it would be worthwhile (and overdue) to update our
kconfig as a whole, but that's some work..

In f3d1e213fef45ba2df4090e9cd02217d1ef82f00 i pulled check-lxdialog
from linux-2.6.26
I guess Denys used kconfig from around 2.6.17 initially and i fear we
never really updated it in busybox. I did update it in buildroot once
or twice and, way back then, stored the buildroot specific diff to ease
future updates. But i fear we never did this in busybox :-/ But checking
7d219aab70e6951ab82c27c202cac05016696723 against the one in 2.6.17-ish
might be a start. Or, of course, just sit down and do a sweeping update
to the current kconfig and bring forward the necessary busybox specific
bits. Maybe someone volunteers to have a look?

cheers,

> 
> Thanks in advance, have a lovely day.
> 
>  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 mailing list