mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-01-16 06:11:00 +01:00
BUG/MINOR: buffer: fix buffer_dump() formatting
The formatting of the buffer_dump() output must be calculated using the relative counter, not the absolute one, or everything will be broken if the <from> variable is not a multiple of 16. Could be backported in all maintained versions.
This commit is contained in:
parent
3eb42f91d9
commit
7e7765a451
@ -75,7 +75,7 @@ void buffer_dump(FILE *o, struct buffer *b, int from, int to)
|
||||
fprintf(o, " %04x: ", from);
|
||||
for (i = 0; ((from + i) < to) && (i < 16) ; i++) {
|
||||
fprintf(o, "%02x ", (unsigned char)b_orig(b)[from + i]);
|
||||
if (((from + i) & 15) == 7)
|
||||
if (i == 7)
|
||||
fprintf(o, "- ");
|
||||
}
|
||||
if (to - from < 16) {
|
||||
@ -89,7 +89,7 @@ void buffer_dump(FILE *o, struct buffer *b, int from, int to)
|
||||
fprintf(o, " ");
|
||||
for (i = 0; (from + i < to) && (i < 16) ; i++) {
|
||||
fprintf(o, "%c", isprint((unsigned char)b_orig(b)[from + i]) ? b_orig(b)[from + i] : '.') ;
|
||||
if ((((from + i) & 15) == 15) && ((from + i) != to-1))
|
||||
if ((i == 15) && ((from + i) != to-1))
|
||||
fprintf(o, "\n");
|
||||
}
|
||||
from += i;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user