On Fri, Oct 16, 2020 at 03:30:56PM -0500, Segher Boessenkool wrote:
> > +     if (len >= printf_len
> > +         && strcmp (name + len - printf_len, "printf") == 0)
> 
> Thew first test is unnecessary.

Actually no, it is necessary.  If you are looking at a builtin function with 4
or fewer characters, if you don't check if len is at least 5 (i.e. >=
printf_len), the expression:

        name + len - printf_len

would be before the beginning of the name pointer.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meiss...@linux.ibm.com, phone: +1 (978) 899-4797

Reply via email to