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

[BUG] senml_json_parse(...) LOG_ARG #676

Closed
parmi93 opened this issue Dec 8, 2022 · 6 comments
Closed

[BUG] senml_json_parse(...) LOG_ARG #676

parmi93 opened this issue Dec 8, 2022 · 6 comments

Comments

@parmi93
Copy link
Contributor

parmi93 commented Dec 8, 2022

I noticed that the payload for write commands sent from Leshan do not have the terminator character at the end of the string, so to avoid memory overflow I had to change this line:
LOG_ARG("bufferLen: %d, buffer: \"%s\"", bufferLen, STR_NULL2EMPTY((char *)buffer));
to
LOG_ARG("bufferLen: %d, buffer: \"%.*s\"", bufferLen, bufferLen, STR_NULL2EMPTY((char *)buffer));

@rettichschnidi
Copy link
Contributor

TIL: There is a .* specifier. Nice!

Do you know if this is (typically) supported on Embedded platforms? Wondering if using this solution would break the code e.g. for the use cases of @sbertin-telular.

@sbertin-telular
Copy link
Contributor

I use .* frequently. I doubt there would be an issue for most embedded platforms. Floating point and wide characters are more likely to be issues than supplying a string length.

@parmi93
Copy link
Contributor Author

parmi93 commented Feb 21, 2023

TIL: There is a .* specifier. Nice!

Do you know if this is (typically) supported on Embedded platforms? Wondering if using this solution would break the code e.g. for the use cases of @sbertin-telular.

I use .* frequently on my embedded platform (Quectel BG95) and it work without any issues.

But if this is your concern, then there might be other format specifiers that might not be supported by embedded platforms, for example in my case %f is not supported, but that is used by Wakaama (in observe.c and data.c)

@rettichschnidi
Copy link
Contributor

rettichschnidi commented Feb 22, 2023

Thanks @sbertin-telular

@parmi93 Any chance to get a PR from you for this? Alternatively, I can do it. Just let me know.

@parmi93
Copy link
Contributor Author

parmi93 commented Feb 22, 2023

Thanks @sbertin-telular

@parmi93 Any chance to get a PR from you for this? Alternatively, I can do it. Just let me know.

excuse my ignorance, but what does PR mean?

@rettichschnidi
Copy link
Contributor

rettichschnidi commented Feb 22, 2023

By PR I meant pull request, which is how code changes usually get done on GitHub.

rettichschnidi added a commit to husqvarnagroup/wakaama that referenced this issue Mar 24, 2023
Fix issue reported in eclipse-wakaama#676.

There are surely more similar issues to be found, but I have not tried to find
them.
rettichschnidi added a commit to husqvarnagroup/wakaama that referenced this issue Mar 24, 2023
Fix issue reported in eclipse-wakaama#676.

There are surely more similar issues to be found, but I have not tried to find
them.
rettichschnidi added a commit to husqvarnagroup/wakaama that referenced this issue Mar 24, 2023
Fix issue reported in eclipse-wakaama#676.

There are surely more similar issues to be found, but I have not tried to find
them.
rettichschnidi added a commit that referenced this issue Mar 31, 2023
Fix issue reported in #676.

There are surely more similar issues to be found, but I have not tried to find
them.
@parmi93 parmi93 closed this as completed Apr 3, 2023
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

3 participants