armink / struct2json

A fast convert library between the JSON and C structure. Implement structure serialization and deserialization for C. | C 结构体与 JSON 快速互转库,快速实现 C 结构体的序列化及反序列化
MIT License
680 stars 293 forks source link

strncpy length? #16

Open yuxuebao opened 3 years ago

yuxuebao commented 3 years ago

struct2json\inc\s2jdef.h line93 strncpy((to_struct)->_element[index], from_json->valuestring,sizeof((to_struct)->_element)-1); 是不是应该是 strncpy((to_struct)->_element[index], from_json->valuestring,sizeof((to_struct)->_element[index])-1); struct2json\inc\s2jdef.h line106 同样问题.

armink commented 3 years ago

看着是的,copy 的长度限制应该是数组元素的长度