Skip to content

Commit

Permalink
Use memcpy instead of strncpy to avoid gcc warnings (issue #104 and #91)
Browse files Browse the repository at this point in the history
  • Loading branch information
benhoyt committed Jun 4, 2020
1 parent 16787c4 commit 8fe4b21
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ini.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ 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 - 1);
/* Use memcpy instead of strncpy to avoid gcc warnings (see issue #91) */
memcpy(dest, src, size - 1);
dest[size - 1] = '\0';
return dest;
}
Expand Down

0 comments on commit 8fe4b21

Please sign in to comment.