[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-6156-g094ec9b

aCaB acab at clamav.net
Sun Apr 4 01:23:06 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit ec22c5824d4eb14237340e8afb7f1400f4210db0
Author: aCaB <acab at clamav.net>
Date:   Fri Mar 19 02:45:33 2010 +0100

    win32: properly handle all relative paths and strip duplicate slashes

diff --git a/win32/compat/w32_stat.c b/win32/compat/w32_stat.c
index ffa07da..d42cfa4 100644
--- a/win32/compat/w32_stat.c
+++ b/win32/compat/w32_stat.c
@@ -46,9 +46,13 @@ wchar_t *uncpath(const char *path) {
 		errno = (len || (GetLastError() == ERROR_INSUFFICIENT_BUFFER)) ? ENAMETOOLONG : ENOENT;
 		return NULL;
 	    }
-	    len += 4;
-	    dest[len] = L'\\';
-	    len++;
+	    if(*path == '\\')
+		len = 6; /* Current drive root */
+	    else {
+		len += 4; /* A 'really' relative path */
+		dest[len] = L'\\';
+		len++;
+	    }
 	} else {
 	    /* C:\ and friends */
 	    len = 4;
@@ -96,6 +100,20 @@ wchar_t *uncpath(const char *path) {
 	}
     }
 
+    /* strip double slashes */
+    if((stripme = wcsstr(&dest[4], L"\\\\"))) {
+	strip_from = stripme;
+	while(1) {
+	    wchar_t c = *strip_from;
+	    strip_from++;
+	    if(c == L'\\' && *strip_from == L'\\')
+		continue;
+	    *stripme = c;
+	    stripme++;
+	    if(!c)
+		break;
+	}
+    }
     if(wcslen(dest) == 6 && !wcsncmp(dest, L"\\\\?\\", 4) && (dest[5] == L':') && ((dest[4] >= L'A' && dest[4] <= L'Z') || (dest[4] >= L'a' && dest[4] <= L'z'))) {
 	dest[6] = L'\\';
 	dest[7] = L'\0';

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list