broken strndup on AIX 5.1

Simo Sorce idra at samba.org
Mon Aug 23 20:56:23 GMT 2004


On Mon, 2004-08-23 at 22:34, Doug VanLeuven wrote:
> Thanks.  No I hadn't.  It's been open since Feb. I agree with you.  Why 
> even use somrthing provably suspect?  It's not a performance issue.  
> Your last post fails for me too on both AIX 5.1 & 5.2 in my build 
> environment.  That's a nice piece of work.  I can't seem to post an 
> additional comment to your bug in the bug thread, so I'll post it here.
> 
> I compile in the Linux affinity environment using gcc.
> gcc-2.9.aix51.020209-4

> yeilds exactly the same results noted at gnu.org for AIX 4.3.3 on both 
> AIX 5.1 and 5.2:
> 
> strlen(strndup("foobar",0)) = 0
> strlen(strndup("foobar",1)) = 3
> strlen(strndup("foobar",2)) = 2
> strlen(strndup("foobar",3)) = 1
> strlen(strndup("foobar",4)) = 0
> strlen(strndup("foobar",5)) = 6
> strlen(strndup("foobar",6)) = 6


Hello Doug
can you please split the code into 2 parts?
I suspect both strnlen and strndup have similar bugs that are summing up
by combinning them
can you just strndup a string and print it, then strnlen it?
this way we can see the bugs separately and maybe spot out a checkable
pattern.

Thanks,
Simo.

-- 
Simo Sorce    -  idra at samba.org
Samba Team    -  http://www.samba.org
Italian Site  -  http://samba.xsec.it



More information about the samba-technical mailing list