summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2008-06-12 17:02:05 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2008-06-12 17:02:05 +0000
commit6abbe975b9cdbd9654e2e38d59321845b6cf5cfd (patch)
treebf43df2c0344094a8c945faa44a1fac0218a3791
parent8ecc89486821aae21f2133a4645bb54b339e9695 (diff)
Oops, do not dereference a NULL function pointer used as an array end
marker; found the hard way by sturm@
-rw-r--r--sys/kern/exec_elf.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/sys/kern/exec_elf.c b/sys/kern/exec_elf.c
index a65ceb374d0..19f4e36933f 100644
--- a/sys/kern/exec_elf.c
+++ b/sys/kern/exec_elf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_elf.c,v 1.64 2008/06/12 04:33:37 miod Exp $ */
+/* $OpenBSD: exec_elf.c,v 1.65 2008/06/12 17:02:04 miod Exp $ */
/*
* Copyright (c) 1996 Per Fogelstrom
@@ -549,9 +549,7 @@ ELFNAME2(exec,makecmds)(struct proc *p, struct exec_package *epp)
goto native;
}
#endif
- for (i = 0;
- i < sizeof(ELFNAME(probes)) / sizeof(ELFNAME(probes)[0]) && error;
- i++) {
+ for (i = 0; ELFNAME(probes)[i].func != NULL && error; i++) {
error = (*ELFNAME(probes)[i].func)(p, epp, interp, &pos, &os);
}
if (!error)