This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug string/19391] strnlen invokes UB by adding maxlen to str
- From: "cherepan at mccme dot ru" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Wed, 30 Dec 2015 10:33:48 +0000
- Subject: [Bug string/19391] strnlen invokes UB by adding maxlen to str
- Auto-submitted: auto-generated
- References: <bug-19391-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=19391
--- Comment #4 from Alexander Cherepanov <cherepan at mccme dot ru> ---
On 2015-12-28 17:18, cherepan at mccme dot ru wrote:
> (In reply to Florian Weimer from comment #1)
>> Isn't strnlen (p, -1) equivalent to strlen (p)? It's difficult to tell from
>> the specification.
>
> 1. I'm not sure what you mean.
Ok, I think I found the reason of the confusion. I was looking at glibc
manual as available on https://www.gnu.org/ but manual/string.texi was
modified recently. In particular, the description of strnlen was changed
by [1]. The current description[2] indeed talks about "the array @var{s}
of size @var{maxlen}". IMHO this is plainly wrong (and contradicts the
use of strnlen in glibc itself).
[1]
https://sourceware.org/git/?p=glibc.git;a=commit;h=2cc4b9cce51643ec299e97450ccde4deeecfb083
[2]
https://sourceware.org/git/?p=glibc.git;a=blob;f=manual/string.texi;h=016fd0b9a05f3126a1594e942c5e6da0669d0410;hb=HEAD#l313
--
You are receiving this mail because:
You are on the CC list for the bug.