From 0a77a0c2b30711afb0d7266d87a063401867f4a0 Mon Sep 17 00:00:00 2001 From: "Marius Niculescu (MariusNi)" Date: Tue, 12 Nov 2024 15:01:41 -0800 Subject: [PATCH] Work in progress --- src/common/commonutils/UrlUtils.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/common/commonutils/UrlUtils.c b/src/common/commonutils/UrlUtils.c index f2454f48e..262a97be5 100644 --- a/src/common/commonutils/UrlUtils.c +++ b/src/common/commonutils/UrlUtils.c @@ -27,18 +27,15 @@ char* UrlEncode(const char* target) encodedTarget[j] = target[i]; j += 1; } - else if ((j + 3) < targetSize) + else if ('\n' == target[i]) { - if ('\n' == target[i]) - { - memcpy(&encodedTarget[j], "%0A", sizeof("%0A")); - j += strlen(&encodedTarget[j]); - } - else - { - sprintf(&encodedTarget[j], "%%%02X", target[i]); - j += strlen(&encodedTarget[j]); - } + memcpy(&encodedTarget[j], "%0A", 3); + j += 3; + } + else + { + sprintf(&encodedTarget[j], "%%%02X", target[i]); + j += 3; } } }