Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ead751c
)
Improved the depth calculation in sanitize_path() so that it properly
author
Wayne Davison
<wayned@samba.org>
Sun, 23 May 2004 23:46:56 +0000
(23:46 +0000)
committer
Wayne Davison
<wayned@samba.org>
Sun, 23 May 2004 23:46:56 +0000
(23:46 +0000)
handles a trailing slash, a leading slash, and an empty string.
util.c
patch
|
blob
|
blame
|
history
diff --git
a/util.c
b/util.c
index
2212723
..
4b46b35
100644
(file)
--- a/
util.c
+++ b/
util.c
@@
-707,9
+707,12
@@
void sanitize_path(char *p, char *reldir)
int allowdotdot = 0;
if (reldir) {
-
depth++
;
+
int new_component = 1
;
while (*reldir) {
- if (*reldir++ == '/') {
+ if (*reldir++ == '/')
+ new_component = 1;
+ else if (new_component) {
+ new_component = 0;
depth++;
}
}