diff options
| author | 2005-05-27 20:05:17 +0000 | |
|---|---|---|
| committer | 2005-05-27 20:05:17 +0000 | |
| commit | f5c0a9194e1de2533b35fe839e6ac07d2265dea9 (patch) | |
| tree | f421ffcc29667a613b2703d00f9749243a95cba7 /usr.sbin/ftp-proxy/ftp-proxy.c | |
| parent | bah, more kaesefondue (debugging cruft left in) (diff) | |
| download | wireguard-openbsd-f5c0a9194e1de2533b35fe839e6ac07d2265dea9.tar.xz wireguard-openbsd-f5c0a9194e1de2533b35fe839e6ac07d2265dea9.zip | |
do not allow nul in the control connection.
ok beck
Diffstat (limited to 'usr.sbin/ftp-proxy/ftp-proxy.c')
| -rw-r--r-- | usr.sbin/ftp-proxy/ftp-proxy.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/usr.sbin/ftp-proxy/ftp-proxy.c b/usr.sbin/ftp-proxy/ftp-proxy.c index eec6925dd75..80aa8895aa8 100644 --- a/usr.sbin/ftp-proxy/ftp-proxy.c +++ b/usr.sbin/ftp-proxy/ftp-proxy.c @@ -244,7 +244,8 @@ client_read(struct bufferevent *bufev, void *arg) } if (n == -1) { - logmsg(LOG_ERR, "#%d client command too long", s->id); + logmsg(LOG_ERR, "#%d client command too long or not" + " clean", s->id); end_session(s); return; } @@ -342,9 +343,13 @@ getline(char *buf, size_t *valid) return (-1); /* Copy to linebuf while searching for a newline. */ - for (i = 0; i < *valid; i++) - if ((linebuf[i] = buf[i]) == '\n') + for (i = 0; i < *valid; i++) { + linebuf[i] = buf[i]; + if (buf[i] == '\0') + return (-1); + if (buf[i] == '\n') break; + } if (i == *valid) { /* No newline found. */ @@ -1036,7 +1041,8 @@ server_read(struct bufferevent *bufev, void *arg) } if (n == -1) { - logmsg(LOG_ERR, "#%d server reply too long", s->id); + logmsg(LOG_ERR, "#%d server reply too long or not" + " clean", s->id); end_session(s); return; } |
