Line 0
Link Here
|
|
|
1 |
--- src/server.c.orig 2020-06-29 10:28:20.530624000 +0200 |
2 |
+++ src/server.c 2020-06-29 10:28:20.558990000 +0200 |
3 |
@@ -1245,17 +1245,34 @@ |
4 |
return; |
5 |
} |
6 |
|
7 |
- oldname = strtok(cp, " "); |
8 |
- if (oldname == NULL) { |
9 |
- error("hardlink: oldname name not delimited"); |
10 |
- return; |
11 |
- } |
12 |
+{ unsigned int len; |
13 |
|
14 |
- newname = strtok((char *)NULL, " "); |
15 |
- if (newname == NULL) { |
16 |
- error("hardlink: new name not specified"); |
17 |
- return; |
18 |
- } |
19 |
+ if( *( cp += strspn( cp, " " ) ) == '\0' ) { |
20 |
+ error("hardlink: oldnamelen name not found"); |
21 |
+ return; |
22 |
+ } |
23 |
+ |
24 |
+ len = strtoul( cp, &cp, 10 ); |
25 |
+ |
26 |
+ if( *( cp += strspn( cp, " " ) ) == '\0' ) { |
27 |
+ error("hardlink: oldname not found"); |
28 |
+ return; |
29 |
+ } |
30 |
+ oldname = cp; |
31 |
+ if( strlen( cp ) < len + 2 ) { |
32 |
+ error("hardlink: oldname too short or nothing following found"); |
33 |
+ return; |
34 |
+ } |
35 |
+ cp += len; |
36 |
+ *cp++ = '\0'; |
37 |
+ |
38 |
+ if( *( cp += strspn( cp, " " ) ) == '\0' ) { |
39 |
+ error("hardlink: newname not found"); |
40 |
+ return; |
41 |
+ } |
42 |
+ |
43 |
+ newname = cp; |
44 |
+} |
45 |
|
46 |
if (exptilde(expbuf, oldname) == NULL) { |
47 |
error("hardlink: tilde expansion failed"); |
48 |
--- src/client.c.orig 2020-06-29 10:28:20.531414000 +0200 |
49 |
+++ src/client.c 2020-06-29 10:28:20.559180000 +0200 |
50 |
@@ -356,16 +356,16 @@ |
51 |
rname, lp->pathname, lp->src, lp->target); |
52 |
|
53 |
if (*lp->target == CNULL) |
54 |
- (void) sendcmd(C_RECVHARDLINK, "%o %s %s", |
55 |
- opts, lp->pathname, rname); |
56 |
+ (void) sendcmd(C_RECVHARDLINK, "%o %d %s %s", |
57 |
+ opts, strlen(lp->pathname), lp->pathname, rname); |
58 |
else { |
59 |
lname = buff; |
60 |
strcpy(lname, remfilename(lp->src, lp->target, |
61 |
lp->pathname, rname, |
62 |
destdir)); |
63 |
debugmsg(DM_MISC, "sendhardlink: lname=%s\n", lname); |
64 |
- (void) sendcmd(C_RECVHARDLINK, "%o %s %s", |
65 |
- opts, lname, rname); |
66 |
+ (void) sendcmd(C_RECVHARDLINK, "%o %d %s %s", |
67 |
+ opts, strlen(lname), lname, rname); |
68 |
} |
69 |
|
70 |
return(response()); |