This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix BZ 23400 -- stdlib/test-bz22786.c creates temporary files in glibc source tree


Thanks for review!

On Mon, Jul 30, 2018 at 1:13 PM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:

> > +  strcpy (lnk, dir);
> > +  strcat (lnk, "/symlink");
>
> Maybe just 'char *lnk = xasprintf ("%s/symlink", dir);' instead?

Done.

> > +  if (symlink (".", lnk) != 0)
> >      {
> >        printf ("symlink (%s, %s): %m\n", dir, lnk);
> >        return EXIT_FAILURE;
>
> Use FAIL_EXIT1 or just TEST_VERIFY_EXIT.

Done.

> >    memset (p, 'a', path_len - (path - p) - 2);
> >    p[path_len - (path - p) - 1] = '\0';
>
> Shouldn't it 'p - path' instead? The subtraction is clearly issuing a
> overflow and I think it is not what the test meant here.

Good catch. Turns out that this was a buffer overflow in the original
test. Fixed.

Thanks,

2018-08-06  Paul Pluzhnikov  <ppluzhnikov@google.com>

        [BZ #23400]
        * stdlib/test-bz22786.c (do_test): Fix undefined behavior.

-- 
Paul Pluzhnikov

Attachment: glibc-bz23400-20180805.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]