-
-
Notifications
You must be signed in to change notification settings - Fork 1k
ImmediateAlertService: fix latent bug #2159
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
Conversation
Include null terminator in the bytes copied. Set notif.size as it is done in AlertNotificationService.cpp and AlertNotificationClient.cpp.
|
Build size and comparison to main:
|
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.
I'm fine with this implementation, but I think that it might be good to also use std::min to avoid overflowing the buffer. (Of course that isn't possible with the current notification strings, but it makes the code more clear if we do that)
Because there are some inconsistencies and incorrect handlings of the notification buffer elsewhere in the code, I'm thinking of adding a constructor to the struct that makes sure it's written correctly. In the meantime, this is a good fix.
|
@FintasticMan Thanks for the review! In general constructor for P.S. Would you like me to implement this constructor? |
|
I was planning on doing it, but if you want to, go ahead! |
mark9064
left a comment
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.
At a glance seems fine to me - haven't looked at the code around this though
Refactoring this problem away would be better but that can be done another time
|
@mark9064, @NeroBurner Should I do the refactoring (implement a constructor for |
|
That would be great :) |
|
I have made a new PR with the refactoring: #2347 |
Include null terminator in the bytes copied.
Set
notif.sizelike it is done in AlertNotificationService.cpp and AlertNotificationClient.cpp.