diff options
author | 2001-12-06 01:28:59 +0000 | |
---|---|---|
committer | 2001-12-06 01:28:59 +0000 | |
commit | 4892d88ffc2282e04272e104bb46ce83f16b9c70 (patch) | |
tree | 8978231d864d2f2b08049337ef29ff46858fdb99 /libexec/ftp-proxy | |
parent | Fix typos, from NetBSD (diff) | |
download | wireguard-openbsd-4892d88ffc2282e04272e104bb46ce83f16b9c70.tar.xz wireguard-openbsd-4892d88ffc2282e04272e104bb46ce83f16b9c70.zip |
Fix realloc in getline so we exit on failure - in this context it's silly
to try to continue and hold on to the same memory if we can't get memory
to hold a control command. log and fail instead. (absurdity spotted by theo)
Diffstat (limited to 'libexec/ftp-proxy')
-rw-r--r-- | libexec/ftp-proxy/getline.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libexec/ftp-proxy/getline.c b/libexec/ftp-proxy/getline.c index 4ed10e4a11a..f76f186d6ad 100644 --- a/libexec/ftp-proxy/getline.c +++ b/libexec/ftp-proxy/getline.c @@ -105,8 +105,10 @@ refill_buffer(register struct csiob *iobp) iobp->io_buffer_size += 128; tmp = realloc(iobp->io_buffer, iobp->io_buffer_size); - if (tmp == NULL) - return(0); + if (tmp == NULL) { + syslog(LOG_INFO, "Insufficient memory"); + exit(EX_UNAVAILABLE); + } iobp->io_buffer = tmp; rqlen = iobp->io_buffer_size - iobp->io_buffer_len; } @@ -150,6 +152,8 @@ refill_buffer(register struct csiob *iobp) * * This code is derived from the getline routine found in the UC Berkeley * ftpd code. + * + * thie */ int @@ -256,8 +260,10 @@ telnet_getline(register struct csiob *iobp, struct csiob *telnet_passthrough) iobp->line_buffer_size = 256 + ix - iobp->next_byte; tmp = realloc(iobp->line_buffer, iobp->line_buffer_size); - if (tmp == NULL) - return(0); + if (tmp == NULL) { + syslog(LOG_INFO, "Insufficient memory"); + exit(EX_UNAVAILABLE); + } iobp->line_buffer = tmp; } |