[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fix memleak in getdelim.m4
From: |
Bruno Haible |
Subject: |
Re: Fix memleak in getdelim.m4 |
Date: |
Thu, 21 May 2020 21:38:55 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-177-generic; KDE/5.18.0; x86_64; ; ) |
Paul Eggert wrote:
> > - if (memmem (haystack, 3, NULL, 0) != haystack)
> > + if (memmem (haystack, 3, (const char *) 1, 0) != haystack)
>
> This has undefined behavior in general, no?
No. memmem is not supposed to access more than NEEDLELEN bytes at NEEDLE.
> How about using '""' instead of '(const char *) 1'?
That would defeat the purpose of the test, which is to test for the glibc 2.0
bug [1].
Bruno
[1] http://man7.org/linux/man-pages/man3/memmem.3.html
- Re: Fix memleak in getdelim.m4, (continued)
- SA_RESETHAND, Bruno Haible, 2020/05/21
- Re: SA_RESETHAND, Paul Eggert, 2020/05/21
- Re: SA_RESETHAND, Bruno Haible, 2020/05/21
- Re: Fix sanitizer error in fchownat.m4, Bruno Haible, 2020/05/21
- Fix memleak in glob.m4, Bruno Haible, 2020/05/21
- Fix memleak in regex.m4, Bruno Haible, 2020/05/21
- Re: Fix memleak in getdelim.m4, Bruno Haible, 2020/05/21
- Re: Fix memleak in getdelim.m4, Paul Eggert, 2020/05/21
- Re: Fix memleak in getdelim.m4,
Bruno Haible <=
Re: Fix memleak in getdelim.m4, Bruno Haible, 2020/05/21