From bfdef0eecb8d61cf8f242ffea8294d02efced851 Mon Sep 17 00:00:00 2001 From: Shaway <39594020+ShawayL@users.noreply.github.com> Date: Sat, 10 Aug 2024 14:38:16 +0800 Subject: [PATCH 1/2] fix ncuriparse error,Correctly remove leading and trailing whitespace --- libdispatch/ncuri.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libdispatch/ncuri.c b/libdispatch/ncuri.c index e5be032e46..8b8ec364e6 100644 --- a/libdispatch/ncuri.c +++ b/libdispatch/ncuri.c @@ -173,7 +173,10 @@ ncuriparse(const char* uri0, NCURI** durip) 2. convert all '\\' -> '\' (Temp hack to remove escape characters inserted by Windows or MinGW) */ - for(q=uri,p=uri;*p;p++) {if((*p == '\\' && p[1] == '\\') || *p < ' ') {continue;} else {*q++ = *p;}} + p = uri; + while(*p == ' ') p++; + for(q=uri;*p;p++) {if((*p == '\\' && p[1] == '\\')) {continue;} else {*q++ = *p;}} + while(*(q - 1) == ' ' && (q - 1) >= uri) q--; *q = '\0'; p = uri; From 503aeb7d587f3f1a3e0b6de78305d44494dafccc Mon Sep 17 00:00:00 2001 From: Shaway <39594020+ShawayL@users.noreply.github.com> Date: Sun, 11 Aug 2024 09:14:06 +0800 Subject: [PATCH 2/2] fix ncuriparse error --- libdispatch/ncuri.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdispatch/ncuri.c b/libdispatch/ncuri.c index 8b8ec364e6..f22b52ea65 100644 --- a/libdispatch/ncuri.c +++ b/libdispatch/ncuri.c @@ -176,7 +176,7 @@ ncuriparse(const char* uri0, NCURI** durip) p = uri; while(*p == ' ') p++; for(q=uri;*p;p++) {if((*p == '\\' && p[1] == '\\')) {continue;} else {*q++ = *p;}} - while(*(q - 1) == ' ' && (q - 1) >= uri) q--; + while((q - 1) >= uri && *(q - 1) == ' ') q--; *q = '\0'; p = uri;