fix: use unsigned char cast and sizeof in LogEscape escape sequence #255

pull mangoostaa wants to merge 1 commits into bitcoin-core:master from mangoostaa:fix/logescape-snprintf changing 1 files +1 −1
  1. mangoostaa commented at 5:37 am on March 12, 2026: contributor

    Found a small correctness issue in LogEscape():

    • When char is signed (common on x86_64 Linux), negative byte values (e.g. 0xFF = -1) were being printed as ffffffff instead of ff.

    • This fixes it by casting to unsigned char before %02x.

    • Also changed the hardcoded 4 to sizeof(escape) so the code doesn’t break silently if someone increases the buffer size later.

    No performance impact, just safer and more portable.

  2. fix: use unsigned char cast and sizeof in LogEscape escape sequence 554a481ea7
  3. DrahtBot commented at 5:37 am on March 12, 2026: none

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK ryanofsky

    If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

  4. ryanofsky approved
  5. ryanofsky commented at 5:43 pm on March 23, 2026: collaborator
    Code review ACK 554a481ea73322c7c233dbc7b077a3cd087a9ef7. Signed fix and sizeof cleanup both makes sense. Nice catch!
  6. ryanofsky merged this on Mar 23, 2026
  7. ryanofsky closed this on Mar 23, 2026


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/libmultiprocess. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-03-29 21:30 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me