Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make unsafe_symlink() take const args so that we don't get any
[rsync/rsync.git]
/
util.c
diff --git
a/util.c
b/util.c
index
63af7da
..
44ff2df
100644
(file)
--- a/
util.c
+++ b/
util.c
@@
-793,15
+793,15
@@
int u_strcmp(const char *cs1, const char *cs2)
*
* @sa t_unsafe.c
**/
*
* @sa t_unsafe.c
**/
-int unsafe_symlink(c
har *dest, char *src
)
+int unsafe_symlink(c
onst char *dest_path, const char *src_path
)
{
{
- char *tok;
+ char *tok
, *src, *dest
;
int depth = 0;
/* all absolute and null symlinks are unsafe */
int depth = 0;
/* all absolute and null symlinks are unsafe */
- if (!dest
|| !(*dest) || (*dest == '/')
) return 1;
+ if (!dest
_path || !*dest_path || *dest_path == '/'
) return 1;
- src = strdup(src);
+ src = strdup(src
_path
);
if (!src) out_of_memory("unsafe_symlink");
/* find out what our safety margin is */
if (!src) out_of_memory("unsafe_symlink");
/* find out what our safety margin is */
@@
-819,7
+819,7
@@
int unsafe_symlink(char *dest, char *src)
/* drop by one to account for the filename portion */
depth--;
/* drop by one to account for the filename portion */
depth--;
- dest = strdup(dest);
+ dest = strdup(dest
_path
);
if (!dest) out_of_memory("unsafe_symlink");
for (tok=strtok(dest,"/"); tok; tok=strtok(NULL,"/")) {
if (!dest) out_of_memory("unsafe_symlink");
for (tok=strtok(dest,"/"); tok; tok=strtok(NULL,"/")) {