Fix error in error.c

This commit is contained in:
Fl0-0 2018-09-19 15:42:56 +02:00
commit f23d3734fa

View file

@ -25,10 +25,10 @@ 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;
strncpy(error->source, "...", 3);
memcpy(error->source, "...", 3);
strncpy(error->source + 3, source + extra, length - extra + 1);
}
}