Source-Changes-HG archive

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

[src/trunk]: src/tests/lib/libc/sys alloca, bad; stack protector, good.



details:   https://anonhg.NetBSD.org/src/rev/7028b8fe7b19
branches:  trunk
changeset: 322983:7028b8fe7b19
user:      christos <christos%NetBSD.org@localhost>
date:      Sun May 27 00:36:56 2018 +0000

description:
alloca, bad; stack protector, good.

diffstat:

 tests/lib/libc/sys/t_ptrace_wait.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (51 lines):

diff -r c5e760f86cab -r 7028b8fe7b19 tests/lib/libc/sys/t_ptrace_wait.c
--- a/tests/lib/libc/sys/t_ptrace_wait.c        Sat May 26 22:49:03 2018 +0000
+++ b/tests/lib/libc/sys/t_ptrace_wait.c        Sun May 27 00:36:56 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_ptrace_wait.c,v 1.54 2018/05/26 15:32:31 kamil Exp $ */
+/*     $NetBSD: t_ptrace_wait.c,v 1.55 2018/05/27 00:36:56 christos Exp $      */
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.54 2018/05/26 15:32:31 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.55 2018/05/27 00:36:56 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -1711,12 +1711,11 @@
 }
 
 static void
-bytes_transfer(int operation, int size, enum bytes_transfer_type type)
+bytes_transfer(int operation, size_t size, enum bytes_transfer_type type)
 {
        const int exitval = 5;
        const int sigval = SIGSTOP;
        pid_t child, wpid;
-
        bool skip = false;
 
        int lookup_me = 0;
@@ -1735,7 +1734,9 @@
 #if defined(TWAIT_HAVE_STATUS)
        int status;
 #endif
-       AuxInfo *ai = NULL, *aip;
+       AuxInfo ai[64], *aip;
+
+       ATF_REQUIRE(size < sizeof(ai));
 
        /* Prepare variables for .TEXT transfers */
        switch (type) {
@@ -1801,7 +1802,6 @@
                }
                break;
        case BYTES_TRANSFER_AUXV:
-               ai = alloca(size);
                io.piod_op = operation;
                io.piod_offs = 0;
                io.piod_addr = ai;



Home | Main Index | Thread Index | Old Index