mirror of https://github.com/mirror/busybox.git
Update safe_strncpy.c
If there is no null byte among the first 'size' bytes of src, the dst string will 'still not' be null-terminated.pull/1/head
parent
86d9f60f3a
commit
56c36f1aa1
|
@ -14,7 +14,7 @@ char* FAST_FUNC safe_strncpy(char *dst, const char *src, size_t size)
|
|||
{
|
||||
if (!size) return dst;
|
||||
dst[--size] = '\0';
|
||||
return strncpy(dst, src, size);
|
||||
return strncpy(dst, src, --size);
|
||||
}
|
||||
|
||||
/* Like strcpy but can copy overlapping strings. */
|
||||
|
|
Loading…
Reference in New Issue