diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2001-01-09 05:07:02 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2001-01-09 05:07:02 +0000 |
commit | 7de59c9dec49a77e3d162b283de07fd811e97097 (patch) | |
tree | 088ffc5198069b3f0f517157b5f2c5a23285d768 /libexec/ftpd/ftpd.c | |
parent | 22ad8b1b0532e695859f8e605eebc99ff0a1408e (diff) |
make sure we do not return stray " at the end of stirng, like bla"\0.
From: "William C. Allen" <allenwc@home.com>
Diffstat (limited to 'libexec/ftpd/ftpd.c')
-rw-r--r-- | libexec/ftpd/ftpd.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index 50a36f7fe1d..b9b67ff4ac4 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftpd.c,v 1.87 2001/01/07 07:38:34 angelos Exp $ */ +/* $OpenBSD: ftpd.c,v 1.88 2001/01/09 05:07:01 itojun Exp $ */ /* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */ /* @@ -1979,13 +1979,16 @@ replydirname(name, message) 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); |