Use memcpy instead of strncpy in wxStrlcpy
Avoid stringop-overflow warning about strncpy size argument depending on source size. Checking for null in src is not needed because it is already checked by strlen.
This commit is contained in:
@@ -257,7 +257,7 @@ inline size_t wxStrlcpy(char *dest, const char *src, size_t n)
|
||||
{
|
||||
if ( n-- > len )
|
||||
n = len;
|
||||
wxCRT_StrncpyA(dest, src, n);
|
||||
wxTmemcpy(dest, src, n);
|
||||
dest[n] = '\0';
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ inline size_t wxStrlcpy(wchar_t *dest, const wchar_t *src, size_t n)
|
||||
{
|
||||
if ( n-- > len )
|
||||
n = len;
|
||||
wxCRT_StrncpyW(dest, src, n);
|
||||
wxTmemcpy(dest, src, n);
|
||||
dest[n] = L'\0';
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user