Re: [RFC] strrstr function in libbb failes on some corner cases

2008-06-17 Thread Bernhard Fischer
On Mon, Jun 16, 2008 at 09:48:07PM +0200, Tito wrote: On Monday 16 June 2008 09:47:31 Bernhard Fischer wrote: On Mon, Jun 16, 2008 at 08:45:18AM +0200, Tito wrote: On Monday 16 June 2008 06:33:35 you wrote: char* strrstr(const char *haystack, const char *needle) { char *r = NULL;

Re: [RFC] strrstr function in libbb failes on some corner cases

2008-06-17 Thread Tito
On Tuesday 17 June 2008 09:43:54 Bernhard Fischer wrote: On Mon, Jun 16, 2008 at 09:48:07PM +0200, Tito wrote: On Monday 16 June 2008 09:47:31 Bernhard Fischer wrote: On Mon, Jun 16, 2008 at 08:45:18AM +0200, Tito wrote: On Monday 16 June 2008 06:33:35 you wrote: char* strrstr(const

Re: [RFC] strrstr function in libbb failes on some corner cases

2008-06-17 Thread Bernhard Fischer
On Tue, Jun 17, 2008 at 01:52:20PM +0200, Tito wrote: HI, Attached you can find a test.c file with both strrstr, mine and Denys', they show little differences on vs. test case. The test cases are improved and checked against the real strstr for consistency. I picked vda's since yours used the

Re: [RFC] strrstr function in libbb failes on some corner cases

2008-06-16 Thread Tito
On Monday 16 June 2008 06:33:35 you wrote: On Sunday 15 June 2008 23:06, Tito wrote: Hi, while inspecting the last changes in busybox code I hit some issues in libbb/strrstr.c. The strrtstr function fails on some corner cases of a little test program I wrote (and bombs out on NULL

Re: [RFC] strrstr function in libbb failes on some corner cases

2008-06-16 Thread Bernhard Fischer
On Mon, Jun 16, 2008 at 08:45:18AM +0200, Tito wrote: On Monday 16 June 2008 06:33:35 you wrote: There was one more reason to avoid strlen, but it was just my personal stupid paranoia: as we don't know the lenght of the strings it was difficult to decide the correct type for the result to

Re: [RFC] strrstr function in libbb failes on some corner cases

2008-06-16 Thread Tito
On Monday 16 June 2008 09:47:31 Bernhard Fischer wrote: On Mon, Jun 16, 2008 at 08:45:18AM +0200, Tito wrote: On Monday 16 June 2008 06:33:35 you wrote: There was one more reason to avoid strlen, but it was just my personal stupid paranoia: as we don't know the lenght of the strings it

[RFC] strrstr function in libbb failes on some corner cases

2008-06-15 Thread Tito
Hi, while inspecting the last changes in busybox code I hit some issues in libbb/strrstr.c. The strrtstr function fails on some corner cases of a little test program I wrote (and bombs out on NULL pointers): char* strrstr(const char *haystack, const char *needle) { char *tmp =

Re: [RFC] strrstr function in libbb failes on some corner cases

2008-06-15 Thread Bernhard Fischer
On Sun, Jun 15, 2008 at 11:06:17PM +0200, Tito wrote: Hi, while inspecting the last changes in busybox code I hit some issues in libbb/strrstr.c. The strrtstr function fails on some corner cases of a little test program I wrote (and bombs out on NULL pointers): This was intended, see below. For

Re: [RFC] strrstr function in libbb failes on some corner cases

2008-06-15 Thread Tito
On Sunday 15 June 2008 23:21:43 Bernhard Fischer wrote: On Sun, Jun 15, 2008 at 11:06:17PM +0200, Tito wrote: Hi, while inspecting the last changes in busybox code I hit some issues in libbb/strrstr.c. The strrtstr function fails on some corner cases of a little test program I wrote (and

Re: [RFC] strrstr function in libbb failes on some corner cases

2008-06-15 Thread Denys Vlasenko
On Sunday 15 June 2008 23:06, Tito wrote: Hi, while inspecting the last changes in busybox code I hit some issues in libbb/strrstr.c. The strrtstr function fails on some corner cases of a little test program I wrote (and bombs out on NULL pointers): char* strrstr(const char *haystack, const