1
0
mirror of https://github.com/benhoyt/inih.git synced 2025-01-28 22:52:54 +08:00

Silence -Wstringop-truncation (#64)

This pull request fixes -Wstringop-truncation (implemented in GCC 8.1), without changing the behavior of the function.
This commit is contained in:
TuxSH 2018-05-15 03:48:24 +02:00 committed by Ben Hoyt
parent 41fae03717
commit 9d1af9d500

2
ini.c
View File

@ -70,7 +70,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;
}