Error out if the PT_INTERP segment isn't NUL terminated
authorguenther <guenther@openbsd.org>
Thu, 30 Apr 2015 03:11:21 +0000 (03:11 +0000)
committerguenther <guenther@openbsd.org>
Thu, 30 Apr 2015 03:11:21 +0000 (03:11 +0000)
ok deraadt@ millert@ miod@

sys/kern/exec_elf.c

index f8bfefe..76fd2d2 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: exec_elf.c,v 1.114 2015/04/26 05:30:42 guenther Exp $ */
+/*     $OpenBSD: exec_elf.c,v 1.115 2015/04/30 03:11:21 guenther Exp $ */
 
 /*
  * Copyright (c) 1996 Per Fogelstrom
@@ -559,6 +559,8 @@ ELFNAME2(exec,makecmds)(struct proc *p, struct exec_package *epp)
                            pp->p_offset, interp, pp->p_filesz)) != 0) {
                                goto bad;
                        }
+                       if (interp[pp->p_filesz - 1] != '\0')
+                               goto bad;
                } else if (pp->p_type == PT_LOAD) {
                        if (pp->p_filesz > pp->p_memsz) {
                                error = EINVAL;