Commit b5d6258
committed
Merge #255: fix: use unsigned char cast and sizeof in LogEscape escape sequence
554a481 fix: use unsigned char cast and sizeof in LogEscape escape sequence (Mangoostaa)
Pull request description:
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.
ACKs for top commit:
ryanofsky:
Code review ACK 554a481. Signed fix and sizeof cleanup both makes sense. Nice catch!
Tree-SHA512: 5a19b3caf4b371a363ed7f5151871e306c91c8e4bf180e7df530a562298b924c8a8e213d82069e580dc9d474bcddc7455d842849d7b50152d6eb29aa1f6e97c01 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| |||
0 commit comments