summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin.dahyabhai@pobox.com>2009-04-27 16:32:00 -0400
committerNalin Dahyabhai <nalin.dahyabhai@pobox.com>2009-04-27 16:32:00 -0400
commit33f0a1eccb17a79368a80c40ee2bd53b34c44adc (patch)
tree5c553e763391cdbf4112ad70f42a4c8db5897376
parentd96208324e2bb67dcd65d90a88c38e59c6895a52 (diff)
downloadslapi-nis-33f0a1eccb17a79368a80c40ee2bd53b34c44adc.tar.gz
slapi-nis-33f0a1eccb17a79368a80c40ee2bd53b34c44adc.tar.xz
slapi-nis-33f0a1eccb17a79368a80c40ee2bd53b34c44adc.zip
- fix some crashes by dereferencing uninitialized pointers when
retrieving information from a map fails
-rw-r--r--NEWS1
-rw-r--r--src/map.c26
2 files changed, 27 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index a42ce3c..45a1ccc 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,4 @@
+0.11 * Fix a crash while reading NIS maps with no entries.
0.10 * IPv6 support for the NIS server plugin.
* Make the NIS server reject client requests which are too big.
* Make the NIS defaults use recursive attribute functions.
diff --git a/src/map.c b/src/map.c
index c5f0e5f..c86aa1b 100644
--- a/src/map.c
+++ b/src/map.c
@@ -436,6 +436,10 @@ map_match(struct plugin_state *state,
struct map *map;
struct map_entry *entry;
unsigned int key_index;
+ *value_len = 0;
+ *value = NULL;
+ *id = NULL;
+ *backend_data = NULL;
map = map_data_find_map(state, domain_name, map_name);
if (map == NULL) {
return FALSE;
@@ -465,6 +469,12 @@ map_match_id(struct plugin_state *state,
{
struct map *map;
struct map_entry *entry;
+ *key_len = 0;
+ *key = NULL;
+ *value_len = 0;
+ *value = NULL;
+ *id = NULL;
+ *backend_data = NULL;
map = map_data_find_map(state, domain_name, map_name);
if (map == NULL) {
return FALSE;
@@ -503,6 +513,12 @@ map_first(struct plugin_state *state,
{
struct map *map;
struct map_entry *entry;
+ *first_key_len = 0;
+ *first_key = NULL;
+ *first_value_len = 0;
+ *first_value = NULL;
+ *first_id = NULL;
+ *first_key_index = 0;
map = map_data_find_map(state, domain_name, map_name);
if (map == NULL) {
return FALSE;
@@ -534,6 +550,10 @@ map_next(struct plugin_state *state,
struct map *map;
struct map_entry *entry;
unsigned int key_index;
+ *next_key_len = 0;
+ *next_key = NULL;
+ *next_value_len = 0;
+ *next_value = NULL;
map = map_data_find_map(state, domain_name, map_name);
if (map == NULL) {
return FALSE;
@@ -570,6 +590,12 @@ map_next_id(struct plugin_state *state,
{
struct map *map;
struct map_entry *entry;
+ *next_key_len = 0;
+ *next_key = NULL;
+ *next_value_len = 0;
+ *next_value = NULL;
+ *next_id = NULL;
+ *next_key_index = 0;
map = map_data_find_map(state, domain_name, map_name);
if (map == NULL) {
return FALSE;