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);
}
}