mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-22 06:37:54 -04:00
BUG/MINOR: tools: Fix loop condition in dump_text()
The condition should first check whether `bsize` is reached, before
dereferencing the offset. Even if this always works fine, due to the
string being null-terminated, this certainly looks odd.
Found using GitHub's CodeQL scan.
This bug traces back to at least 97c2ae13bc
(1.7.0+) and this patch should be backported accordingly.
This commit is contained in:
parent
1f269c12dc
commit
18795d48a9
1 changed files with 2 additions and 2 deletions
|
|
@ -4522,9 +4522,9 @@ int may_access(const void *ptr)
|
|||
int dump_text(struct buffer *out, const char *buf, int bsize)
|
||||
{
|
||||
unsigned char c;
|
||||
int ptr = 0;
|
||||
size_t ptr = 0;
|
||||
|
||||
while (buf[ptr] && ptr < bsize) {
|
||||
while (ptr < bsize && buf[ptr]) {
|
||||
c = buf[ptr];
|
||||
if (isprint((unsigned char)c) && isascii((unsigned char)c) && c != '\\' && c != ' ' && c != '=') {
|
||||
if (out->data > out->size - 1)
|
||||
|
|
|
|||
Loading…
Reference in a new issue