lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <81b0412b1001180756u4daf3099h76d633f1f1143f05@mail.gmail.com>
Date:	Mon, 18 Jan 2010 16:56:05 +0100
From:	Alex Riesen <raa.lkml@...il.com>
To:	rostedt@...dmis.org
Cc:	Li Zefan <lizf@...fujitsu.com>, Ingo Molnar <mingo@...e.hu>,
	Frederic Weisbecker <fweisbec@...il.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 4/7] lib: Introduce strnstr()

On Mon, Jan 18, 2010 at 15:53, Steven Rostedt <rostedt@...dmis.org> wrote:
> On Sat, 2010-01-16 at 12:12 +0100, Alex Riesen wrote:
>>
>> Are you sure you want to search _past_ the NUL-terminator
>> of s1?
>>
>> > +       l2 = strlen(s2);
>> > +       if (!l2)
>> > +               return (char *)s1;
>> > +       while (l1 >= l2) {
>> > +               l1--;
>
> The first check is len-1, I don't see it searching past the
> NUL-terminator. The loop will stop when l1 == l2 (the size of s2) and s1
> pointing near the end of the string.

I thought that len means "minimum of strlen(s1) and len".

Li already explained that was not intended, even if s2 cannot be made to
contain a \0, as s1 can by specifying len greater than strlen(s1).
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ