Module Name: src
Committed By: haad
Date: Tue Apr 14 02:53:41 UTC 2009
Modified Files:
src/common/lib/libprop: prop_dictionary.c
Log Message:
Check if pd is not NULL before we try to lock rw lock associated with it.
This fixes proplib crash when NULL is passed to prop_dictionary_get as a
dictionary.
To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/common/lib/libprop/prop_dictionary.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/common/lib/libprop/prop_dictionary.c
diff -u src/common/lib/libprop/prop_dictionary.c:1.34 src/common/lib/libprop/prop_dictionary.c:1.35
--- src/common/lib/libprop/prop_dictionary.c:1.34 Sat Jan 3 18:31:33 2009
+++ src/common/lib/libprop/prop_dictionary.c Tue Apr 14 02:53:41 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: prop_dictionary.c,v 1.34 2009/01/03 18:31:33 pooka Exp $ */
+/* $NetBSD: prop_dictionary.c,v 1.35 2009/04/14 02:53:41 haad Exp $ */
/*-
* Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
@@ -936,7 +936,10 @@
prop_object_t
prop_dictionary_get(prop_dictionary_t pd, const char *key)
{
- prop_object_t po;
+ prop_object_t po = NULL;
+
+ if (! prop_object_is_dictionary(pd))
+ return (NULL);
_PROP_RWLOCK_RDLOCK(pd->pd_rwlock);
po = _prop_dictionary_get(pd, key, true);