[PATCH] -X, --no-parent should check prefix is a full directory.
George Ogata <[email protected]> Sun, 17 Jul 2005 19:44:35 +1000
| Newsgroups | gmane.comp.web.wget.patches |
|---|---|
| Message-ID | <[email protected]> |
Hello,
Here's a patch to fix:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=215137
Regards,
George.
diff -Naur wget-stable/src/ChangeLog wget-stable.mod/src/ChangeLog
--- wget-stable/src/ChangeLog 2005-07-17 18:32:41.000000000 +1000
+++ wget-stable.mod/src/ChangeLog 2005-07-17 19:21:37.724827128 +1000
@@ -1,3 +1,7 @@
+2005-07-17 George Ogata <[email protected]>
+
+ * utils.c (frontcmp): Check that the prefix is a full directory.
+
2005-07-08 Gisle Vanem <[email protected]>
* mswindows.h: Include process.h to get getpid() declaration.
diff -Naur wget-stable/src/utils.c wget-stable.mod/src/utils.c
--- wget-stable/src/utils.c 2005-07-17 18:32:41.000000000 +1000
+++ wget-stable.mod/src/utils.c 2005-07-17 19:33:44.394356568 +1000
@@ -677,9 +677,9 @@
return true;
}
-/* Compare S1 and S2 frontally; S2 must begin with S1. E.g. if S1 is
- `/something', frontcmp() will return true only if S2 begins with
- `/something'. */
+/* Compare S1 and S2 frontally; S1 must be a leading directory of S2.
+ E.g. if S1 is `/something', frontcmp() will return true if and only
+ if S2 begins with `/something/' or is exactly '/something'. */
bool
frontcmp (const char *s1, const char *s2)
{
@@ -689,7 +689,7 @@
else
for (; *s1 && *s2 && (TOLOWER (*s1) == TOLOWER (*s2)); ++s1, ++s2)
;
- return *s1 == '\0';
+ return *s1 == '\0' && (*s2 == '\0' || *s2 == '/');
}
/* Iterate through STRLIST, and return the first element that matches