summaryrefslogtreecommitdiff
path: root/libexec/ld.so
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2013-01-19 20:04:06 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2013-01-19 20:04:06 +0000
commit93672047394421a7c085b3ffcc047c299b846ac8 (patch)
treeb566553cc7a64114637d6aa2d12d3ee1d6d3c62f /libexec/ld.so
parent08b87de1bb899fd1d8d8524f9333cc09bf8f3561 (diff)
Do not divide by zero in _dl_findhint() if there is a valid hints file but
no buckets in it (could happen if the administrator reruns ldconfig with bogus paths). ok matthew@ kurt@ drahn
Diffstat (limited to 'libexec/ld.so')
-rw-r--r--libexec/ld.so/sod.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libexec/ld.so/sod.c b/libexec/ld.so/sod.c
index 9c3c64df3c9..5fc908853c4 100644
--- a/libexec/ld.so/sod.c
+++ b/libexec/ld.so/sod.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sod.c,v 1.24 2012/06/12 20:32:17 matthew Exp $ */
+/* $OpenBSD: sod.c,v 1.25 2013/01/19 20:04:05 miod Exp $ */
/*
* Copyright (c) 1993 Paul Kranenburg
@@ -213,6 +213,9 @@ _dl_findhint(char *name, int major, int minor, char *preferred_path)
if (!(HINTS_VALID))
return NULL;
+ if (hheader->hh_nbucket == 0)
+ return NULL;
+
bp = hbuckets + (_dl_hinthash(name, major, minor) % hheader->hh_nbucket);
while (1) {