Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 5 Dec 2012 23:14:56 -0500
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: Fix strverscmp

On Wed, Dec 05, 2012 at 07:18:19PM -0800, Isaac Dunham wrote:
> > It can't set the flag unconditionally, only if the previous byte was
> > not a digit. Otherwise, non-leading zeros would break handling of
> > numeric differences.
> Fortunately for us, that appears to be incorrect:
> idunham@...acal:~$ ./a.out jan012 jan0111
> 1
> 1
> idunham@...acal:~$ ./a.out jan0001 jan001
> -1
> -1
> idunham@...acal:~$ ./a.out 0001 001
> -1
> -1
> idunham@...acal:~$ ./a.out 001 0001
> 1
> 1
> idunham@...acal:~$ ./a.out 0012 00111
> 1
> 1
> idunham@...acal:~$ ./a.out 00012 00111
> -1
> -1
> idunham@...acal:~$ ./a.out 00120 00111
> 1
> 1
> 
> That's testing with the attached version.

All that means is that you missed testing any case where it differs.

./a.out s10212 s102102
2
-1

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.