lkml.org 
[lkml]   [2006]   [Jun]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [Patch] Zoran strncpy() cleanup
From
Date
> Problem is, the strings are (possibly) still not zero-terminated:
> strncpy() only appends zeroes if src contents are short enough; if they
> are not, dest is only zero-terminated if dest[sizeof(dest)-1] was zero
> before.
> strlcpy() semantics promise more sanity; dest is always zero-terminated
> (if its size is >= 1), and the size parameter holds total dest size.
> (See lib/string.c for more details.)

In all cases there is a memset() which sets the entire structure to
zero. Since we never write to the last byte with the strncpy() it will
be null terminated. But if you think strlcpy() is safer for the future,
i can make you a third patch.

Greetings, Eric

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-06-05 23:48    [W:0.046 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site