diff options
author | ache <ache@FreeBSD.org> | 1998-06-29 07:02:15 +0800 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1998-06-29 07:02:15 +0800 |
commit | fd82e371fc77602e722b683cf4e52fece23d8f34 (patch) | |
tree | 240530d2e8d7308b9f270d70afcd4f940a560af4 /mail | |
parent | 45b4b16d0356b4d7c36abf674bf27f6e5ba8d808 (diff) | |
download | freebsd-ports-graphics-fd82e371fc77602e722b683cf4e52fece23d8f34.tar.gz freebsd-ports-graphics-fd82e371fc77602e722b683cf4e52fece23d8f34.tar.zst freebsd-ports-graphics-fd82e371fc77602e722b683cf4e52fece23d8f34.zip |
Add check for max parameter length
Submitted by: "Aaron D. Gifford" <agifford@infowest.com>
Diffstat (limited to 'mail')
-rw-r--r-- | mail/popper/files/patch-ak | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/mail/popper/files/patch-ak b/mail/popper/files/patch-ak new file mode 100644 index 00000000000..369314e5aca --- /dev/null +++ b/mail/popper/files/patch-ak @@ -0,0 +1,72 @@ +*** pop_parse.c.old Wed Nov 19 14:20:38 1997 +--- pop_parse.c Sat Jun 27 22:58:17 1998 +*************** char * buf; /* Pointer +*** 26,31 **** +--- 26,32 ---- + { + char * mp; + register int i; ++ register int parmlen; + + /* Loop through the POP command array */ + for (mp = buf, i = 0; ; i++) { +*************** char * buf; /* Pointer +*** 45,52 **** + /* Point to the start of the token */ + p->pop_parm[i] = mp; + + /* Search for the first space character (end of the token) */ +! while (!isspace(*mp) && *mp) mp++; + + /* Delimit the token with a null */ + if (*mp) *mp++ = 0; +--- 46,75 ---- + /* Point to the start of the token */ + p->pop_parm[i] = mp; + ++ /* Start counting the length of this token */ ++ parmlen = 0; ++ + /* Search for the first space character (end of the token) */ +! while (!isspace(*mp) && *mp) { +! mp++; +! parmlen++; +! if (parmlen > MAXPARMLEN) { +! /* Truncate parameter to the max. allowable size */ +! *mp = '\0'; +! +! /* Fail with an appropriate message */ +! if (i == 0) { +! pop_msg(p,POP_FAILURE, +! "Command \"%s\" (truncated) exceedes maximum permitted size.", +! p->pop_command); +! } else { +! pop_msg(p,POP_FAILURE, +! "Argument %d \"%s\" (truncated) exceeds maximum permitted size.", +! i, p->pop_parm[i]); +! } +! return(-1); +! } +! } + + /* Delimit the token with a null */ + if (*mp) *mp++ = 0; +*** popper.h.old Sun Jun 28 12:58:15 1998 +--- popper.h Sun Jun 28 11:56:10 1998 +*************** +*** 59,65 **** + #define MAXMSGLINELEN MAXLINELEN + #define MAXCMDLEN 4 + #define MAXPARMCOUNT 5 +! #define MAXPARMLEN 10 + #define ALLOC_MSGS 20 + + #ifndef OSF1 +--- 59,65 ---- + #define MAXMSGLINELEN MAXLINELEN + #define MAXCMDLEN 4 + #define MAXPARMCOUNT 5 +! #define MAXPARMLEN 32 /* Large enough for 32-byte APOP parm. */ + #define ALLOC_MSGS 20 + + #ifndef OSF1 |