commit e91e3055d2d50e982c810d8dd2deb89ade52eb64
parent 45f60a2d8a3140f14a3cc74bdac0ec919d7f3f20
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date: Thu, 25 Dec 2025 18:39:34 +0100
mhd_str_pct_decode_*_n(): fixed handling of broken PCT-code at the end of the string
Must be backported
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/mhd2/mhd_str.c b/src/mhd2/mhd_str.c
@@ -2055,7 +2055,7 @@ mhd_str_pct_decode_strict_n (const char *pct_encoded,
const char chr = pct_encoded[r];
if ('%' == chr)
{
- if (2 > pct_encoded_len - r)
+ if (2 >= pct_encoded_len - r)
return 0;
else
{
@@ -2087,7 +2087,7 @@ mhd_str_pct_decode_strict_n (const char *pct_encoded,
return 0;
if ('%' == chr)
{
- if (2 > pct_encoded_len - r)
+ if (2 >= pct_encoded_len - r)
return 0;
else
{
@@ -2137,7 +2137,7 @@ mhd_str_pct_decode_lenient_n (const char *pct_encoded,
const char chr = pct_encoded[r];
if ('%' == chr)
{
- if (2 > pct_encoded_len - r)
+ if (2 >= pct_encoded_len - r)
{
if (NULL != broken_encoding)
*broken_encoding = true;
@@ -2182,7 +2182,7 @@ mhd_str_pct_decode_lenient_n (const char *pct_encoded,
return 0;
if ('%' == chr)
{
- if (2 > pct_encoded_len - r)
+ if (2 >= pct_encoded_len - r)
{
if (NULL != broken_encoding)
*broken_encoding = true;