summaryrefslogtreecommitdiff
path: root/net/wu-ftpd/patches/patch-al
blob: abd68a2bc3843e1a10ac79d09cf780f0866f8ca8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$NetBSD: patch-al,v 1.3 1999/02/13 09:05:02 rh Exp $

--- src/realpath.c.orig	Mon Jul  6 11:14:39 1998
+++ src/realpath.c	Sat Feb 13 07:47:55 1999
@@ -143,7 +143,13 @@
             continue;
         if ((last == namebuf) || (*--last != '/'))
             strcat(namebuf, "/");
+	if (strlen(namebuf)+strlen(where) < sizeof(namebuf)) {
         strcat(namebuf, where);
+	} else {
+	    /* path too long: bail out */
+	    strcpy(result, "\0");
+	    return (NULL);
+	}
 
         where = ++ptr;
         if (lstat(namebuf, &sbuf) == -1) {
@@ -164,7 +170,13 @@
                 *workpath = '\0';
             if (*where) {
                 strcat(linkpath, "/");
+		if (strlen(linkpath) + strlen(where) < sizeof(linkpath)) {
                 strcat(linkpath, where);
+		} else {
+		    /* path too long: bail out */
+		    strcpy(result, "\0");
+		    return (NULL);
+		}
             }
             strcpy(curpath, linkpath);
             goto loop;