diff options
author | brian <brian@FreeBSD.org> | 2001-08-20 13:44:13 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2001-08-20 13:44:13 +0000 |
commit | 3b24d8f2afd8e1e1e8b0f3748babfb3d24a57ddb (patch) | |
tree | dd721bd0b0a8cab00af374d2151db7c9eeb83881 /lib/libfetch | |
parent | d48c427cd5bdebd62fe29b534bab868f697332da (diff) | |
download | FreeBSD-src-3b24d8f2afd8e1e1e8b0f3748babfb3d24a57ddb.zip FreeBSD-src-3b24d8f2afd8e1e1e8b0f3748babfb3d24a57ddb.tar.gz |
Handle snrintf overflows.
Spotted by: bde
Diffstat (limited to 'lib/libfetch')
-rw-r--r-- | lib/libfetch/ftp.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/libfetch/ftp.c b/lib/libfetch/ftp.c index 1274019..25ea020 100644 --- a/lib/libfetch/ftp.c +++ b/lib/libfetch/ftp.c @@ -746,6 +746,8 @@ _ftp_authenticate(int cd, struct url *url, struct url *purl) logname = FTP_ANONYMOUS_USER; if ((len = snprintf(pbuf, MAXLOGNAME + 1, "%s@", logname)) == -1) len = 0; + else if (len > MAXLOGNAME) + len = MAXLOGNAME; gethostname(pbuf + len, sizeof pbuf - len); pwd = pbuf; } |