From 23cf2c5f01d3465a139c7b6ea7b3abb26e3ae080 Mon Sep 17 00:00:00 2001 From: Marton Balint Date: Mon, 1 Sep 2025 00:21:57 +0200 Subject: [PATCH] avformat/urldecode: fix decoding last char if it was percent encoded The length check was too strict and if the end of the string was a percent encoded sequence it did not decode correctly. Signed-off-by: Marton Balint --- libavformat/urldecode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/urldecode.c b/libavformat/urldecode.c index 5261bcd0cd..150c64c15c 100644 --- a/libavformat/urldecode.c +++ b/libavformat/urldecode.c @@ -50,7 +50,7 @@ char *ff_urldecode(const char *url, int decode_plus_sign) while (s < url_len) { c = url[s++]; - if (c == '%' && s + 2 < url_len) { + if (c == '%' && s + 1 < url_len) { char c2 = url[s++]; char c3 = url[s++]; if (av_isxdigit(c2) && av_isxdigit(c3)) {