Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Sat, 11 Aug 2012 18:42:19 -0400
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: wcsstr is broken

On Fri, Aug 10, 2012 at 05:41:36PM +0200, Szabolcs Nagy wrote:
> naive_wcsstr is wrong, h can overrun in the inner loop
> as reported in irc:
> 
> 16:36 < dkl> with certain input, it appears to be overrunning
> 16:36 < dkl> for example: wcsstr(L"ab", L"ac");
> ....
> 16:41 < dkl> in this case the inner one keeps increasing the "h" pointer past the null terminator
> 16:44 < dkl> I had a go at a patch too: http://jafile.com/uploads/dkl/0001-wcsstr-fix-buffer-overrun.patch
> 
> see patch below

Is my fix in git acceptable (just removing the buggy function and
always calling twoway) or would you like to put back a working
function? Looking back, I find it kind of ugly to have a function
written to handle arbitrary-length needles that's only used for really
short ones...

Rich

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.