ImmediateAlertService: fix latent bug#2159
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.
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.
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.