Messages in this thread | | | Subject | Re: [Patch] Zoran strncpy() cleanup | From | Eric Sesterhenn <> | Date | Mon, 05 Jun 2006 23:46:14 +0200 |
| |
> 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/
| |