Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Check interp after reading it. Checking newly alloc...



details:   https://anonhg.NetBSD.org/src/rev/c4cc8332f8d2
branches:  trunk
changeset: 325383:c4cc8332f8d2
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sat Dec 21 17:44:33 2013 +0000

description:
Check interp after reading it. Checking newly allocated memory doesn't
work.

Hi Christos.

diffstat:

 sys/kern/exec_elf.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (36 lines):

diff -r b8df29de40fd -r c4cc8332f8d2 sys/kern/exec_elf.c
--- a/sys/kern/exec_elf.c       Sat Dec 21 17:12:36 2013 +0000
+++ b/sys/kern/exec_elf.c       Sat Dec 21 17:44:33 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exec_elf.c,v 1.52 2013/12/21 14:41:02 christos Exp $   */
+/*     $NetBSD: exec_elf.c,v 1.53 2013/12/21 17:44:33 skrll Exp $      */
 
 /*-
  * Copyright (c) 1994, 2000, 2005 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.52 2013/12/21 14:41:02 christos Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.53 2013/12/21 17:44:33 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pax.h"
@@ -709,14 +709,14 @@
                                goto bad;
                        }
                        interp = PNBUF_GET();
+                       if ((error = exec_read_from(l, epp->ep_vp,
+                           pp->p_offset, interp, pp->p_filesz)) != 0)
+                               goto bad;
                        /* Ensure interp is NUL-terminated and of the expected length */
                        if (strnlen(interp, pp->p_filesz) != pp->p_filesz - 1) {
                                error = ENOEXEC;
                                goto bad;
                        }
-                       if ((error = exec_read_from(l, epp->ep_vp,
-                           pp->p_offset, interp, pp->p_filesz)) != 0)
-                               goto bad;
                        break;
                }
        }



Home | Main Index | Thread Index | Old Index