summaryrefslogtreecommitdiffstats
path: root/crypto/telnet/telnetd/ext.h
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2001-07-20 12:02:30 +0000
committerru <ru@FreeBSD.org>2001-07-20 12:02:30 +0000
commit4b023c5a9f160b15b1ae45ac500512e1209b8c02 (patch)
tree423ada7eed1633a885efca42128ef9d5203034c1 /crypto/telnet/telnetd/ext.h
parent719efadfd6a1b229021ba4ba691e87765dea919b (diff)
downloadFreeBSD-src-4b023c5a9f160b15b1ae45ac500512e1209b8c02.zip
FreeBSD-src-4b023c5a9f160b15b1ae45ac500512e1209b8c02.tar.gz
More potential buffer overflow fixes.
o Fixed `nfrontp' calculations in output_data(). If `remaining' is initially zero, it was possible for `nfrontp' to be decremented. Noticed by: dillon o Replaced leaking writenet() with output_datalen(): : * writenet : * : * Just a handy little function to write a bit of raw data to the net. : * It will force a transmit of the buffer if necessary : * : * arguments : * ptr - A pointer to a character string to write : * len - How many bytes to write : */ : void : writenet(ptr, len) : register unsigned char *ptr; : register int len; : { : /* flush buffer if no room for new data) */ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ : if ((&netobuf[BUFSIZ] - nfrontp) < len) { : /* if this fails, don't worry, buffer is a little big */ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ : netflush(); : } : : memmove(nfrontp, ptr, len); : nfrontp += len; : : } /* end of writenet */ What an irony! :-) o Optimized output_datalen() a bit.
Diffstat (limited to 'crypto/telnet/telnetd/ext.h')
-rw-r--r--crypto/telnet/telnetd/ext.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/crypto/telnet/telnetd/ext.h b/crypto/telnet/telnetd/ext.h
index f1bb02a..74dd985 100644
--- a/crypto/telnet/telnetd/ext.h
+++ b/crypto/telnet/telnetd/ext.h
@@ -74,7 +74,7 @@ extern char ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp;
extern char netibuf[BUFSIZ], *netip;
-extern char netobuf[BUFSIZ+NETSLOP], *nfrontp, *nbackp;
+extern char netobuf[BUFSIZ], *nfrontp, *nbackp;
extern char *neturg; /* one past last bye of urgent data */
extern int pcc, ncc;
@@ -187,8 +187,7 @@ extern void
tty_setsofttab P((int)),
tty_tspeed P((int)),
willoption P((int)),
- wontoption P((int)),
- writenet P((unsigned char *, int));
+ wontoption P((int));
int output_data __P((const char *, ...)) __printflike(1, 2);
int output_datalen __P((const char *, size_t));
OpenPOWER on IntegriCloud