mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-21 22:03:19 -07:00
Fix error in error.c
This commit is contained in:
parent
2758d83652
commit
f23d3734fa
1 changed files with 2 additions and 2 deletions
|
@ -25,10 +25,10 @@ void jsonp_error_set_source(json_error_t *error, const char *source)
|
||||||
|
|
||||||
length = strlen(source);
|
length = strlen(source);
|
||||||
if(length < JSON_ERROR_SOURCE_LENGTH)
|
if(length < JSON_ERROR_SOURCE_LENGTH)
|
||||||
strncpy(error->source, source, length + 1);
|
strncpy(error->source, source, JSON_ERROR_SOURCE_LENGTH);
|
||||||
else {
|
else {
|
||||||
size_t extra = length - JSON_ERROR_SOURCE_LENGTH + 4;
|
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);
|
strncpy(error->source + 3, source + extra, length - extra + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue