* Re: [KJ] critical bug in strncpy() - solved
@ 2005-03-29 7:19 walter harms
0 siblings, 0 replies; only message in thread
From: walter harms @ 2005-03-29 7:19 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 790 bytes --]
mea culpa,
for some odd reason i did not see "the dest will be padded with nulls."
i will send a fix for the documentation to the mainling list.
re,
walter
Matthew Wilcox wrote:
> There is no bug in lib/string.c's implementation of strncpy().
> Most people do not realise that strncpy is a stupid function that is
> almost impossible to use correctly. Read the manpage:
>
> The strncpy() function is similar, except that not more than n bytes of
> src are copied. Thus, if there is no null byte among the first n bytes
> of src, the result will not be null-terminated.
>
> In the case where the length of src is less than that of n, the remain-
> der of dest will be padded with nulls.
>
> This agrees with POSIX, ANSI C and Single Unix, fwiw.
>
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-03-29 7:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-29 7:19 [KJ] critical bug in strncpy() - solved walter harms
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.