Merge pull request #1512 from kwagyeman/kwabena/fix_strncpy

Fix strncpy issue with new GCC
This commit is contained in:
Ibrahim Abdelkader 2022-01-26 15:49:12 +02:00 committed by GitHub
commit 9d8dcf8d5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -309,7 +309,7 @@ static char* find_chars_or_comment(const char* s, const char* chars)
/* Version of strncpy that ensures dest (size bytes) is null-terminated. */
static char* strncpy0(char* dest, const char* src, size_t size)
{
strncpy(dest, src, size);
strncpy(dest, src, size - 1);
dest[size - 1] = '\0';
return dest;
}