-
Notifications
You must be signed in to change notification settings - Fork 81
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
Don't accept strings with '\0' for C operations. #2601
base: master
Are you sure you want to change the base?
Conversation
src/primitive_core.cc
Outdated
ARGS(Blob, message, bool, add_newline); | ||
auto bytes = message.address(); | ||
for (int i = 0; i < message.length(); i++) { | ||
putchar(bytes[i]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this stderr? This looks like a pretty significant regression.
I'd take something like my suggestion above and maybe put it in a static helper function parameterized with the stream.
Also, consider making both member variables of Blob
const like:
private:
const uint8* const address_;
const word length_;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch...
I will update the blob fields in a separate PR.
Co-authored-by: Kasper Lund <kasper@toit.io>
Good feedback. |
src/primitive_core.cc
Outdated
fprintf(stderr, "%s%s", message, add_newline ? "\n" : ""); | ||
fflush(stderr); | ||
ARGS(Blob, message, bool, add_newline); | ||
write_to(stderr, message.address(), message.length()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happened to the newline?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
No description provided.