Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/ftpd a few changes from Mike Heffner <mheffner%vt.ed@localhost...



details:   https://anonhg.NetBSD.org/src/rev/fbe2d3a6a92d
branches:  trunk
changeset: 515200:fbe2d3a6a92d
user:      lukem <lukem%NetBSD.org@localhost>
date:      Wed Sep 19 00:50:52 2001 +0000

description:
a few changes from Mike Heffner <mheffner%vt.edu@localhost> in private email:
- totally clear a glob buffer before use, because FreeBSD depends on
  some of the other fields being cleared (other than just gl_offs)
- in strend(), ensure that the source string isn't too large
- remove unnecessarily complicated sizing of proctitle, since snprintf()
  will truncate it anyway

diffstat:

 libexec/ftpd/conf.c    |  8 ++++----
 libexec/ftpd/ftpd.c    |  8 +++-----
 libexec/ftpd/version.h |  4 ++--
 3 files changed, 9 insertions(+), 11 deletions(-)

diffs (81 lines):

diff -r 5cf0d2d03813 -r fbe2d3a6a92d libexec/ftpd/conf.c
--- a/libexec/ftpd/conf.c       Wed Sep 19 00:49:55 2001 +0000
+++ b/libexec/ftpd/conf.c       Wed Sep 19 00:50:52 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: conf.c,v 1.43 2001/06/26 19:30:44 lukem Exp $  */
+/*     $NetBSD: conf.c,v 1.44 2001/09/19 00:50:52 lukem Exp $  */
 
 /*-
  * Copyright (c) 1997-2001 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: conf.c,v 1.43 2001/06/26 19:30:44 lukem Exp $");
+__RCSID("$NetBSD: conf.c,v 1.44 2001/09/19 00:50:52 lukem Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -597,7 +597,7 @@
        if (EMPTYSTR(curclass.notify))
                return;
 
-       gl.gl_offs = 0;
+       memset(&gl, 0, sizeof(gl));
        if (glob(curclass.notify, GLOB_LIMIT, NULL, &gl) != 0
            || gl.gl_matchc == 0) {
                globfree(&gl);
@@ -801,7 +801,7 @@
        l1 = strlen(s1);
        l2 = strlen(s2);
 
-       if (l2 >= l1)
+       if (l2 >= l1 || l1 >= sizeof(buf))
                return(NULL);
        
        strlcpy(buf, s1, sizeof(buf));
diff -r 5cf0d2d03813 -r fbe2d3a6a92d libexec/ftpd/ftpd.c
--- a/libexec/ftpd/ftpd.c       Wed Sep 19 00:49:55 2001 +0000
+++ b/libexec/ftpd/ftpd.c       Wed Sep 19 00:50:52 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ftpd.c,v 1.128 2001/07/08 07:27:14 lukem Exp $ */
+/*     $NetBSD: ftpd.c,v 1.129 2001/09/19 00:50:52 lukem Exp $ */
 
 /*
  * Copyright (c) 1997-2001 The NetBSD Foundation, Inc.
@@ -109,7 +109,7 @@
 #if 0
 static char sccsid[] = "@(#)ftpd.c     8.5 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: ftpd.c,v 1.128 2001/07/08 07:27:14 lukem Exp $");
+__RCSID("$NetBSD: ftpd.c,v 1.129 2001/09/19 00:50:52 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -1126,9 +1126,7 @@
                reply(230, "Guest login ok, access restrictions apply.");
 #if HAVE_SETPROCTITLE
                snprintf(proctitle, sizeof(proctitle),
-                   "%s: anonymous/%.*s", remotehost,
-                   (int) (sizeof(proctitle) - sizeof(remotehost) -
-                   sizeof(": anonymous/")), passwd);
+                   "%s: anonymous/%s", remotehost, passwd);
                setproctitle("%s", proctitle);
 #endif /* HAVE_SETPROCTITLE */
                if (logging)
diff -r 5cf0d2d03813 -r fbe2d3a6a92d libexec/ftpd/version.h
--- a/libexec/ftpd/version.h    Wed Sep 19 00:49:55 2001 +0000
+++ b/libexec/ftpd/version.h    Wed Sep 19 00:50:52 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: version.h,v 1.33 2001/06/26 19:30:45 lukem Exp $       */
+/*     $NetBSD: version.h,v 1.34 2001/09/19 00:50:53 lukem Exp $       */
 /*-
  * Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -36,5 +36,5 @@
  */
 
 #ifndef FTPD_VERSION
-#define        FTPD_VERSION    "NetBSD-ftpd 20010627"
+#define        FTPD_VERSION    "NetBSD-ftpd 20010919"
 #endif



Home | Main Index | Thread Index | Old Index