]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: sample: Fix bytes converter if offset is bigger than sample length
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 10 Nov 2023 09:33:01 +0000 (10:33 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 13 Nov 2023 10:06:05 +0000 (11:06 +0100)
commit33a1fc883ae5e99f60f79331adf0f741a37c0295
treea47859535fbffcf5bea08dbd8ec24d20dc9e77ed
parenta06f6212c9dec94b6c4b15b6ed53d445336c2a38
BUG/MINOR: sample: Fix bytes converter if offset is bigger than sample length

When the bytes converter was improved to be able to use variables (915e48675
["MEDIUM: sample: Enhances converter "bytes" to take variable names as
arguments"]), the behavior of the sample slightly change. A failure is
reported if the given offset is bigger than the sample length. Before, a
empty binary sample was returned.

This patch fixes the converter to restore the original behavior. The
function was also refactored to properly handle failures by removing
SMP_F_MAY_CHANGE flag. Because the converter now handles variables, the
conversion to an integer may fail. In this case SMP_F_MAY_CHANGE flag must
be removed to be sure the caller will not retry.

This patch should fix the issue #2335. No backport needed except if commit
above is backported.
src/sample.c