svn commit: r309643 - stable/9/contrib/telnet/telnetd
Gleb Smirnoff
glebius at FreeBSD.org
Tue Dec 6 18:52:34 UTC 2016
Author: glebius
Date: Tue Dec 6 18:52:33 2016
New Revision: 309643
URL: https://svnweb.freebsd.org/changeset/base/309643
Log:
Merge r309638 from head:
When telnetd(8) composes argument list for login(1), an unexpected sequence
of memory allocation failures combined with insufficient error checking
could result in the construction and execution of an argument sequence that
was not intended.
Fix that treating malloc(3) failures as fatal condition.
Submitted by: brooks
Security: FreeBSD-SA-16:36.telnetd
Modified:
stable/9/contrib/telnet/telnetd/sys_term.c
Directory Properties:
stable/9/ (props changed)
stable/9/contrib/ (props changed)
stable/9/contrib/telnet/ (props changed)
Modified: stable/9/contrib/telnet/telnetd/sys_term.c
==============================================================================
--- stable/9/contrib/telnet/telnetd/sys_term.c Tue Dec 6 18:52:18 2016 (r309642)
+++ stable/9/contrib/telnet/telnetd/sys_term.c Tue Dec 6 18:52:33 2016 (r309643)
@@ -1163,7 +1163,7 @@ addarg(char **argv, const char *val)
*/
argv = (char **)malloc(sizeof(*argv) * 12);
if (argv == NULL)
- return(NULL);
+ fatal(net, "failure allocating argument space");
*argv++ = (char *)10;
*argv = (char *)0;
}
@@ -1174,11 +1174,12 @@ addarg(char **argv, const char *val)
*argv = (char *)((long)(*argv) + 10);
argv = (char **)realloc(argv, sizeof(*argv)*((long)(*argv) + 2));
if (argv == NULL)
- return(NULL);
+ fatal(net, "failure allocating argument space");
argv++;
cpp = &argv[(long)argv[-1] - 10];
}
- *cpp++ = strdup(val);
+ if ((*cpp++ = strdup(val)) == NULL)
+ fatal(net, "failure allocating argument space");
*cpp = 0;
return(argv);
}
More information about the svn-src-stable
mailing list