From: Nishi Date: Thu, 19 Sep 2024 09:28:44 +0000 (+0000) Subject: fix X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=d26da0e5453ab68bba6f48c6bd967c9f9d6f3e71;p=tewi.git fix git-svn-id: file:///raid/svn-personal/tewi/trunk@71 8739d7e6-ffea-ec47-b151-bdff447c6205 --- diff --git a/Server/server.c b/Server/server.c index 1c78386..678ff37 100644 --- a/Server/server.c +++ b/Server/server.c @@ -485,9 +485,16 @@ void tw_server_pass(int sock, bool ssl, int port, SOCKADDR addr) { cm_log("Server", "Filesystem path is %s", path); bool rej = false; #ifdef __MINGW32__ + char* rpath = cm_strdup(path); + for(i = strlen(rpath) - 1; i >= 0; i++) { + if(rpath[i] != ':'){ + break; + } + rpath[i] = 0; + } for(i = 0; i < sizeof(reserved_names) / sizeof(reserved_names[0]); i++) { char* n = cm_strcat("/", reserved_names[i]); - if(cm_nocase_endswith(path, n)) { + if(cm_nocase_endswith(rpath, n)) { tw_http_error(s, sock, 403, name, port); free(n); rej = true; @@ -495,16 +502,8 @@ void tw_server_pass(int sock, bool ssl, int port, SOCKADDR addr) { break; } free(n); - char* y = cm_strcat3("/", reserved_names[i], ":"); - if(cm_nocase_endswith(path, y)) { - tw_http_error(s, sock, 403, name, port); - free(y); - rej = true; - cm_log("Server", "XP Patch ; rejecting access to device"); - break; - } - free(y); } + free(rpath); #endif struct stat st; if(!rej && stat(path, &st) == 0) {