]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/jansson/error.c
Code improved for less memory
[proxmark3-svn] / client / jansson / error.c
index cbd50d7e17c4e1ad937d53018470e8d34c364bf3..b94b3a3a17362aa11c83d123ddf493d14a91cebd 100644 (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);
     }
 }
Impressum, Datenschutz