blob: e9994f2c9d834a07c5ee9e48dd9ee8f9da5dedee [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001Upstream-Status: Inappropriate [1]
2
3[1] Not the author, the patch is from:
4http://vault.centos.org/5.8/os/SRPMS/rdist-6.1.5-44.src.rpm
5
6--- rdist-6.1.5/src/client.c.links Wed Feb 17 17:46:09 1999
7+++ rdist-6.1.5/src/client.c Wed Feb 17 17:51:15 1999
8@@ -309,6 +309,18 @@
9 return(0);
10 }
11
12+void freelinkinfo(lp)
13+ struct linkbuf *lp;
14+{
15+ if (lp->pathname)
16+ free(lp->pathname);
17+ if (lp->src)
18+ free(lp->src);
19+ if (lp->target)
20+ free(lp->target);
21+ free(lp);
22+}
23+
24 /*
25 * Save and retrieve hard link info
26 */
27@@ -317,6 +329,7 @@
28 {
29 struct linkbuf *lp;
30
31+ /* xxx: linear search doesn't scale with many links */
32 for (lp = ihead; lp != NULL; lp = lp->nextp)
33 if (lp->inum == statp->st_ino && lp->devnum == statp->st_dev) {
34 lp->count--;
35@@ -329,12 +342,14 @@
36 lp->inum = statp->st_ino;
37 lp->devnum = statp->st_dev;
38 lp->count = statp->st_nlink - 1;
39- (void) strcpy(lp->pathname, target);
40- (void) strcpy(lp->src, source);
41+ lp->pathname = strdup(target);
42+ lp->src = strdup(source);
43 if (Tdest)
44- (void) strcpy(lp->target, Tdest);
45+ lp->target = strdup(Tdest);
46 else
47- *lp->target = CNULL;
48+ lp->target = NULL;
49+ if (!lp->pathname || !lp->src || !(Tdest && lp->target))
50+ fatalerr("Cannot malloc memory in linkinfo.");
51
52 return((struct linkbuf *) NULL);
53 }
54--- rdist-6.1.5/src/docmd.c.links Wed Feb 17 17:51:23 1999
55+++ rdist-6.1.5/src/docmd.c Wed Feb 17 17:52:44 1999
56@@ -586,7 +586,7 @@
57 if (!nflag) {
58 register struct linkbuf *nextl, *l;
59
60- for (l = ihead; l != NULL; free((char *)l), l = nextl) {
61+ for (l = ihead; l != NULL; freelinkinfo(l), l = nextl) {
62 nextl = l->nextp;
63 if (contimedout || IS_ON(opts, DO_IGNLNKS) ||
64 l->count == 0)
65--- rdist-6.1.5/include/defs.h.links Wed Feb 17 17:52:58 1999
66+++ rdist-6.1.5/include/defs.h Wed Feb 17 17:53:47 1999
67@@ -276,9 +276,9 @@
68 ino_t inum;
69 dev_t devnum;
70 int count;
71- char pathname[BUFSIZ];
72- char src[BUFSIZ];
73- char target[BUFSIZ];
74+ char *pathname;
75+ char *src;
76+ char *target;
77 struct linkbuf *nextp;
78 };
79