From: Christopher Faulet Date: Tue, 7 Jul 2026 09:54:05 +0000 (+0200) Subject: BUG/MINOR: http-conv: Make url-dec failed if no space for trailing null byte X-Git-Tag: v3.5-dev2~15 X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/$%7BGITURL%7D/static/gitweb.js?a=commitdiff_plain;h=36243965a04da0d06bd6ecb9f4a7895e90bf605d;p=haproxy.git BUG/MINOR: http-conv: Make url-dec failed if no space for trailing null byte for url-dec converter, a trailing null byte is added at the end of the input sample because it is requested by url_decode() function. However, when the buffer was full, the last byte was crushed by the trailing null byte. In that case, the last character was lost and not decoded. Now, the converter just fails by returning 0. This patch could be backported to all supported versions but it is a very minor issue. --- diff --git a/src/http_conv.c b/src/http_conv.c index 5449f7adc..ed276b2e8 100644 --- a/src/http_conv.c +++ b/src/http_conv.c @@ -273,6 +273,9 @@ static int sample_conv_url_dec(const struct arg *args, struct sample *smp, void smp->flags &= ~SMP_F_CONST; } + if (smp->data.u.str.size <= smp->data.u.str.data) + return 0; + /* Add final \0 required by url_decode(), and convert the input string. */ smp->data.u.str.area[smp->data.u.str.data] = '\0';