fix off-by-one buffer overflow in copy_hex_string - #1674
Merged
michaelrsweet merged 1 commit intoAug 20, 2026
Conversation
Signed-off-by: Aizal Khan <aizumusheer2@gmail.com>
michaelrsweet
approved these changes
Aug 20, 2026
Member
|
Since octetString values are limited to 1023 bytes and the output buffer in ipptool is 1024 bytes, this isn't an issue in practice but the fix does address the correctness of the code going forward... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Was checking the octetString paths in
with_valueagainst an IPP server I control. ASan tripped when the server returned a value whose length was exactlysizeof(temp):copy_hex_stringclamps the copy length with>where it wants>=. When an all-printable octetString is exactlybufsizebytes the clamp is skipped, somemcpyfills the whole buffer andbuffer[datalen]writes the terminating NUL one byte past the end. Both call sites pass a 1024-bytetemp[], so a response attribute of 1024 printable bytes is enough. The over-length case (> bufsize) already truncates tobufsize - 1; the exact-fit case just fell through the gap.