Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6-0]: src/lib/libc/cdb Pull up following revision(s) (requested b...
details: https://anonhg.NetBSD.org/src/rev/31ee793c1257
branches: netbsd-6-0
changeset: 774656:31ee793c1257
user: riz <riz%NetBSD.org@localhost>
date: Fri Oct 19 17:31:28 2012 +0000
description:
Pull up following revision(s) (requested by joerg in ticket #577):
lib/libc/cdb/cdbr.c: revision 1.4
Don't refuse the open databases without entries or keys, just protect
the divisions. cdbr_find and cdbr_get already have the appropiate
checks.
diffstat:
lib/libc/cdb/cdbr.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diffs (46 lines):
diff -r 77f2ce6260ac -r 31ee793c1257 lib/libc/cdb/cdbr.c
--- a/lib/libc/cdb/cdbr.c Wed Oct 17 22:44:46 2012 +0000
+++ b/lib/libc/cdb/cdbr.c Fri Oct 19 17:31:28 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cdbr.c,v 1.2.8.1 2012/06/23 22:54:58 riz Exp $ */
+/* $NetBSD: cdbr.c,v 1.2.8.1.4.1 2012/10/19 17:31:28 riz Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -36,7 +36,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: cdbr.c,v 1.2.8.1 2012/06/23 22:54:58 riz Exp $");
+__RCSID("$NetBSD: cdbr.c,v 1.2.8.1.4.1 2012/10/19 17:31:28 riz Exp $");
#include "namespace.h"
@@ -152,17 +152,21 @@
cdbr->data_base < cdbr->mmap_base ||
cdbr->data_base + cdbr->data_size < cdbr->mmap_base ||
cdbr->data_base + cdbr->data_size >
- cdbr->mmap_base + cdbr->mmap_size ||
- cdbr->entries == 0 || cdbr->entries_index == 0) {
+ cdbr->mmap_base + cdbr->mmap_size) {
errno = EINVAL;
cdbr_close(cdbr);
return NULL;
}
- fast_divide32_prepare(cdbr->entries, &cdbr->entries_m,
- &cdbr->entries_s1, &cdbr->entries_s2);
- fast_divide32_prepare(cdbr->entries_index, &cdbr->entries_index_m,
- &cdbr->entries_index_s1, &cdbr->entries_index_s2);
+ if (cdbr->entries) {
+ fast_divide32_prepare(cdbr->entries, &cdbr->entries_m,
+ &cdbr->entries_s1, &cdbr->entries_s2);
+ }
+ if (cdbr->entries_index) {
+ fast_divide32_prepare(cdbr->entries_index,
+ &cdbr->entries_index_m,
+ &cdbr->entries_index_s1, &cdbr->entries_index_s2);
+ }
return cdbr;
}
Home |
Main Index |
Thread Index |
Old Index