Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strncpy length? #16

Open
yuxuebao opened this issue Feb 22, 2021 · 1 comment
Open

strncpy length? #16

yuxuebao opened this issue Feb 22, 2021 · 1 comment

Comments

@yuxuebao
Copy link
Contributor

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
Copy link
Owner

armink commented Feb 22, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants