Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/libexec/ftpd/ftpd.c,v rcsdiff: /ftp/cvs/cvsroot/src/libexec/ftpd/ftpd.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.61 retrieving revision 1.61.2.4 diff -u -p -r1.61 -r1.61.2.4 --- src/libexec/ftpd/ftpd.c 1998/12/28 04:54:01 1.61 +++ src/libexec/ftpd/ftpd.c 2000/12/14 22:33:47 1.61.2.4 @@ -1,4 +1,4 @@ -/* $NetBSD: ftpd.c,v 1.61 1998/12/28 04:54:01 lukem Exp $ */ +/* $NetBSD: ftpd.c,v 1.61.2.4 2000/12/14 22:33:47 he Exp $ */ /* * Copyright (c) 1985, 1988, 1990, 1992, 1993, 1994 @@ -44,7 +44,7 @@ __COPYRIGHT( #if 0 static char sccsid[] = "@(#)ftpd.c 8.5 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: ftpd.c,v 1.61 1998/12/28 04:54:01 lukem Exp $"); +__RCSID("$NetBSD: ftpd.c,v 1.61.2.4 2000/12/14 22:33:47 he Exp $"); #endif #endif /* not lint */ @@ -105,7 +105,7 @@ __RCSID("$NetBSD: ftpd.c,v 1.61 1998/12/ #define FALSE 0 #endif -const char version[] = "Version: 7.1.0"; +const char version[] = "Version: 7.1.0a"; struct sockaddr_in ctrl_addr; struct sockaddr_in data_source; @@ -486,7 +486,7 @@ checkuser(fname, name, def, nofile) while (fgets(line, sizeof(line), fd) != NULL) { glob = strtok(line, " \t\n"); - if (glob[0] == '#') + if (glob == NULL || glob[0] == '#') continue; perm = strtok(NULL, " \t\n"); if (fnmatch(glob, name, 0) == 0) { @@ -712,7 +712,7 @@ skip: "%s: anonymous/%.*s", remotehost, (int) (sizeof(proctitle) - sizeof(remotehost) - sizeof(": anonymous/")), passwd); - setproctitle(proctitle); + setproctitle("%s", proctitle); #endif /* HASSETPROCTITLE */ if (logging) syslog(LOG_INFO, "ANONYMOUS FTP LOGIN FROM %s, %s", @@ -722,7 +722,7 @@ skip: #ifdef HASSETPROCTITLE snprintf(proctitle, sizeof(proctitle), "%s: %s", remotehost, pw->pw_name); - setproctitle(proctitle); + setproctitle("%s", proctitle); #endif /* HASSETPROCTITLE */ if (logging) syslog(LOG_INFO, "FTP LOGIN FROM %s as %s", @@ -1418,15 +1418,21 @@ static void replydirname(name, message) const char *name, *message; { - char npath[MAXPATHLEN + 1]; - int i; + char *p, *ep; + char npath[MAXPATHLEN]; - for (i = 0; *name != '\0' && i < sizeof(npath) - 1; i++, name++) { - npath[i] = *name; - if (*name == '"') - npath[++i] = '"'; + p = npath; + ep = &npath[sizeof(npath) - 1]; + while (*name) { + if (*name == '"' && ep - p >= 2) { + *p++ = *name++; + *p++ = '"'; + } else if (ep - p >= 1) + *p++ = *name++; + else + break; } - npath[i] = '\0'; + *p = '\0'; reply(257, "\"%s\" %s", npath, message); } @@ -1507,7 +1513,7 @@ dolog(sin) remotehost[sizeof(remotehost) - 1] = '\0'; #ifdef HASSETPROCTITLE snprintf(proctitle, sizeof(proctitle), "%s: connected", remotehost); - setproctitle(proctitle); + setproctitle("%s", proctitle); #endif /* HASSETPROCTITLE */ if (logging)