]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: sample: Fix wrong 'base64urldec' return value check in 'jwt_member_query'
authorRemi Tricot-Le Breton <rlebreton@haproxy.com>
Thu, 15 Oct 2026 14:42:36 +0000 (16:42 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 20 Oct 2026 06:07:29 +0000 (08:07 +0200)
The 'base64urldec' function return value was only checked against -1
when it can also return -2 in case of error (too small out buffer).

This was raised in GitHub issue #3510.
This patch can be backported to all stable branches.

src/sample.c

index c34f143a8e0b102f03b1112a367bb188c7e88798..7f2a93df6f2372391b9251aab089402ebdf4e7ba 100644 (file)
@@ -5072,7 +5072,7 @@ static int sample_conv_jwt_member_query(const struct arg *args, struct sample *s
 
        ret = base64urldec(items[member].start, items[member].length,
                           decoded_header->area, decoded_header->size);
-       if (ret == -1)
+       if (ret < 0)
                goto end;
 
        /* mjson might return an embedded \0 that is not valid as a string */