Skip to content

Commit

Permalink
Fix for "jansson/src/error.c: error: '__builtin_strncpy' specified bo…
Browse files Browse the repository at this point in the history
…und depends on the length of the source argument [-Werror=stringop-truncation]"
  • Loading branch information
sbytnar committed Sep 26, 2024
1 parent 61fc3d0 commit 0e3b06d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void jsonp_error_set_source(json_error_t *error, const char *source) {

length = strlen(source);
if (length < JSON_ERROR_SOURCE_LENGTH)
strncpy(error->source, source, length + 1);
strncpy(error->source, source, JSON_ERROR_SOURCE_LENGTH);
else {
size_t extra = length - JSON_ERROR_SOURCE_LENGTH + 4;
memcpy(error->source, "...", 3);
Expand Down

0 comments on commit 0e3b06d

Please sign in to comment.