BUG/MINOR: tools: Fix loop condition in dump_text()
authorTim Duesterhus <tim@bastelstu.be>
Sat, 28 Aug 2021 22:58:22 +0000 (00:58 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 30 Aug 2021 04:14:50 +0000 (06:14 +0200)
commit18795d48a9bb09aedc57e547029828a56322e49d
treed336a1751528bc2bed5b8fce8ca40af2278d8cbf
parent1f269c12dc31bb63db31559cb44c187ab91abb64
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 97c2ae13bc0d7961a348102d6719fbcaf34d46d5
(1.7.0+) and this patch should be backported accordingly.
src/tools.c