From 93672047394421a7c085b3ffcc047c299b846ac8 Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Sat, 19 Jan 2013 20:04:06 +0000 Subject: 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 --- libexec/ld.so/sod.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libexec/ld.so') 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) { -- cgit v1.2.3