Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/telnetd Abort if memory for execv(2) argument array ...



details:   https://anonhg.NetBSD.org/src/rev/e9e5918da945
branches:  trunk
changeset: 480051:e9e5918da945
user:      tron <tron%NetBSD.org@localhost>
date:      Fri Dec 31 12:42:35 1999 +0000

description:
Abort if memory for execv(2) argument array cannot be allocated instead
of passing an array with incomplete contents to login(1).
Fix provided by Jun-ichiro itojun Hagino in PR bin/9082.

diffstat:

 libexec/telnetd/sys_term.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r 7583c7906548 -r e9e5918da945 libexec/telnetd/sys_term.c
--- a/libexec/telnetd/sys_term.c        Fri Dec 31 12:21:06 1999 +0000
+++ b/libexec/telnetd/sys_term.c        Fri Dec 31 12:42:35 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_term.c,v 1.17 1999/09/17 19:00:32 aidan Exp $      */
+/*     $NetBSD: sys_term.c,v 1.18 1999/12/31 12:42:35 tron Exp $       */
 
 /*
  * Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)sys_term.c 8.4+1 (Berkeley) 5/30/95";
 #else
-__RCSID("$NetBSD: sys_term.c,v 1.17 1999/09/17 19:00:32 aidan Exp $");
+__RCSID("$NetBSD: sys_term.c,v 1.18 1999/12/31 12:42:35 tron Exp $");
 #endif
 #endif /* not lint */
 
@@ -1865,8 +1865,10 @@
                --argv;
                *argv = (char *)((long)(*argv) + 10);
                argv = (char **)realloc(argv, sizeof(*argv)*((long)(*argv) + 2));
-               if (argv == NULL)
-                       return(NULL);
+               if (argv == NULL) {
+                       fatal(net, "not enough memory");
+                       /*NOTREACHED*/
+               }
                argv++;
                cpp = &argv[(long)argv[-1] - 10];
        }



Home | Main Index | Thread Index | Old Index