andy at splashground.de
Tue Jun 20 23:55:46 PDT 2006
dillon wrote @ Tue, 20 Jun 2006 23:27:14 -0700 (PDT):
> :andy wrote @ 20 Jun 2006 21:44:17 +0200:
> :Fixed the off-by-one:
> Umm. That code is broken. len is only the maximum allowed length,
> the actual string may be smaller.
> so e.g. someone might do: strndup("fubar", 16384). The returned
> string should only be 'fubar\0', and only 6 bytes should be allocated,
> not 16384.
But when it works like that, one does not save the strlen.
Hence i see the dislike for the function.
I would like to have one, that does not work like that.
Is there already a name for it?
More information about the Submit