akheron / jansson

C library for encoding, decoding and manipulating JSON data
http://www.digip.org/jansson/
Other
3.05k stars 808 forks source link

Fix strncpy compile warning #607

Open glezmen opened 2 years ago

glezmen commented 2 years ago

Original code caused compile warnings:

/home/mstrbldr/x86/sas/Vendor/jansson/src/error.c: In function ‘jsonp_error_set_source.part.0’: /home/mstrbldr/x86/sas/Vendor/jansson/src/error.c:28:9: error: ‘__builtin_strncpy’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=] 28 | strncpy(error->source, source, length + 1); | ^~~ /home/mstrbldr/x86/sas/Vendor/jansson/src/error.c:26:14: note: length computed here 26 | length = strlen(source); | ^~~~~~