lib/libdsa/dsalib_confs.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
New commits:
commit a9085ef0baae4c6a6997aa2c9b795c7ebac827d2
Author: Noriko Hosoi <nhosoi(a)jiji.usersys.redhat.com>
Date: Mon Feb 7 18:14:21 2011 -0800
Bug 387981 - plain files can be chosen on the Restore Directory dialog
https://bugzilla.redhat.com/show_bug.cgi?id=387981
Description: dsalib_ldif_parse_line: OpenLDAP ldif_read_record
takes buffer with its length and resizes it if it internally
requires more memory. The function dsalib_ldif_parse_line did
not properly initialize the address and the size which caused
the memory problem and crashed some CGIs such as ds_listdb.
This patch initializes the address and size to 0.
diff --git a/lib/libdsa/dsalib_confs.c b/lib/libdsa/dsalib_confs.c
index c7049bc..3e4380d 100644
--- a/lib/libdsa/dsalib_confs.c
+++ b/lib/libdsa/dsalib_confs.c
@@ -55,8 +55,8 @@ dsalib_ldif_parse_line(
rc = ldif_parse_line(line, &type->bv_val, &value->bv_val, &vlen);
type->bv_len = type->bv_val ? strlen(type->bv_val) : 0;
value->bv_len = vlen;
- *freeval = 0; /* always returns in place */
#endif
+ *freeval = 0; /* always returns in place */
return rc;
}
@@ -77,7 +77,7 @@ ds_get_conf_from_file(FILE *conf)
char *entry = 0;
int lineno = 0;
#if defined(USE_OPENLDAP)
- int buflen;
+ int buflen = 0;
#endif
#if defined(USE_OPENLDAP)
@@ -118,6 +118,8 @@ ds_get_conf_from_file(FILE *conf)
}
}
free(begin);
+ entry = NULL;
+ buflen = 0;
}
return(conf_list);