diff options
author | Colin Percival <cperciva@FreeBSD.org> | 2009-02-16 21:56:17 +0000 |
---|---|---|
committer | Colin Percival <cperciva@FreeBSD.org> | 2009-02-16 21:56:17 +0000 |
commit | bb602bfc7c7d3bf85832427c2e5f1d836d318194 (patch) | |
tree | d7512333d6f10f0aa3f982da32ef9d11067055d8 | |
parent | a5718404886956d936e753a6a5a314eefbf064eb (diff) | |
download | src-bb602bfc7c7d3bf85832427c2e5f1d836d318194.tar.gz src-bb602bfc7c7d3bf85832427c2e5f1d836d318194.zip |
Correctly scrub telnetd's environment.
Approved by: so (cperciva)
Security: FreeBSD-SA-09:05.telnetd
Notes
Notes:
svn path=/releng/7.0/; revision=188699
-rw-r--r-- | UPDATING | 3 | ||||
-rw-r--r-- | contrib/telnet/telnetd/sys_term.c | 23 | ||||
-rw-r--r-- | sys/conf/newvers.sh | 2 |
3 files changed, 23 insertions, 5 deletions
@@ -8,6 +8,9 @@ Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. +20090216: p10 FreeBSD-SA-09:05.telnetd + Correctly scrub telnetd's environment. + 20090113: p9 FreeBSD-SA-09:03.ntpd, FreeBSD-SA-09:04.bind Correct ntpd cryptographic signature bypass. [09:03] diff --git a/contrib/telnet/telnetd/sys_term.c b/contrib/telnet/telnetd/sys_term.c index 151c5b45215d..08e1a2a4adba 100644 --- a/contrib/telnet/telnetd/sys_term.c +++ b/contrib/telnet/telnetd/sys_term.c @@ -1285,8 +1285,18 @@ scrub_env(void) char **cpp, **cpp2; const char **p; - - for (cpp2 = cpp = environ; *cpp; cpp++) { + char ** new_environ; + size_t count; + + /* Allocate space for scrubbed environment. */ + for (count = 1, cpp = environ; *cpp; count++, cpp++) + continue; + if ((new_environ = malloc(count * sizeof(char *))) == NULL) { + environ = NULL; + return; + } + + for (cpp2 = new_environ, cpp = environ; *cpp; cpp++) { int reject_it = 0; for(p = rej; *p; p++) @@ -1300,10 +1310,15 @@ scrub_env(void) for(p = acc; *p; p++) if(strncmp(*cpp, *p, strlen(*p)) == 0) break; - if(*p != NULL) - *cpp2++ = *cpp; + if(*p != NULL) { + if ((*cpp2++ = strdup(*cpp)) == NULL) { + environ = new_environ; + return; + } + } } *cpp2 = NULL; + environ = new_environ; } /* diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index a65223c29994..3d224a3fee5b 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="7.0" -BRANCH="RELEASE-p9" +BRANCH="RELEASE-p10" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi |