Re: [PATCH] [gdb] Fix heap-buffer-overflow in args_complete_p

Tom Tromey
2026-01-05T16:39:31Z

>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

Tom> + auto at = [&] (const char *s)
Tom> + {
Tom> + return s > end ? '\0' : *s;
Tom> + };

I think it would better to avoid stepping off the end at the points
where the pointer is incremented.

Tom> + while (at (input) != '\0')

Like this could be

for (input = skip_spaces (input); *input != '\0'; input = skip_spaces (input))

and then there's like one or two spots to check in the loop.

Tom