Source-Changes-HG archive

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

[src/trunk]: src/libexec/ftpd make sure we do not return stray " at the end o...



details:   https://anonhg.NetBSD.org/src/rev/f58d3e1bda2a
branches:  trunk
changeset: 501913:f58d3e1bda2a
user:      itojun <itojun%NetBSD.org@localhost>
date:      Tue Jan 09 05:06:14 2001 +0000

description:
make sure we do not return stray " at the end of stirng, like bla"\0.
From: "William C. Allen" <allenwc%home.com@localhost>

diffstat:

 libexec/ftpd/cmds.c |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (39 lines):

diff -r 2d734e286a12 -r f58d3e1bda2a libexec/ftpd/cmds.c
--- a/libexec/ftpd/cmds.c       Tue Jan 09 05:05:35 2001 +0000
+++ b/libexec/ftpd/cmds.c       Tue Jan 09 05:06:14 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cmds.c,v 1.10 2000/12/18 02:32:50 lukem Exp $  */
+/*     $NetBSD: cmds.c,v 1.11 2001/01/09 05:06:14 itojun Exp $ */
 
 /*
  * Copyright (c) 1999-2000 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: cmds.c,v 1.10 2000/12/18 02:32:50 lukem Exp $");
+__RCSID("$NetBSD: cmds.c,v 1.11 2001/01/09 05:06:14 itojun Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -797,13 +797,16 @@
        p = npath;
        ep = &npath[sizeof(npath) - 1];
        while (*name) {
-               if (*name == '"' && ep - p >= 2) {
+               if (*name == '"') {
+                       if (ep - p < 2)
+                               break;
                        *p++ = *name++;
                        *p++ = '"';
-               } else if (ep - p >= 1)
+               } else {
+                       if (ep - p < 1)
+                               break;
                        *p++ = *name++;
-               else
-                       break;
+               }
        }
        *p = '\0';
        reply(257, "\"%s\" %s", npath, message);



Home | Main Index | Thread Index | Old Index