diff options
author | Rich Megginson <rmeggins@redhat.com> | 2010-02-25 10:03:52 -0700 |
---|---|---|
committer | Rich Megginson <rmeggins@redhat.com> | 2010-02-26 11:20:01 -0700 |
commit | ea0cdc6ce1cf1c9a690acab443e6df11b3e0fe15 (patch) | |
tree | f933a8474c3e2e0b0373396a10ed00ba8847aff3 | |
parent | 2c285270cca9cc4b05bb1423da69e559cd7e7fd9 (diff) | |
download | ds-ea0cdc6ce1cf1c9a690acab443e6df11b3e0fe15.tar.gz ds-ea0cdc6ce1cf1c9a690acab443e6df11b3e0fe15.tar.xz ds-ea0cdc6ce1cf1c9a690acab443e6df11b3e0fe15.zip |
389 DS segfaults on libsyntax-plugin.so - part 1
https://bugzilla.redhat.com/show_bug.cgi?id=516611
Resolves: bug 516611
Bug Description: 389 DS segfaults on libsyntax-plugin.so - part 1
Reviewed by: nkinder (Thanks!)
Branch: HEAD
Fix Description: Check for NULL bvals in the string syntax filter functions
ava, sub, and key generation
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
-rw-r--r-- | ldap/servers/plugins/syntaxes/string.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ldap/servers/plugins/syntaxes/string.c b/ldap/servers/plugins/syntaxes/string.c index c2f0fa60..ad607dc4 100644 --- a/ldap/servers/plugins/syntaxes/string.c +++ b/ldap/servers/plugins/syntaxes/string.c @@ -77,7 +77,7 @@ string_filter_ava( struct berval *bvfilter, Slapi_Value **bvals, int syntax, value_normalize( bvfilter_norm.bv_val, syntax, 1 /* trim leading blanks */ ); bvfilter_norm.bv_len = strlen(bvfilter_norm.bv_val); - for ( i = 0; bvals[i] != NULL; i++ ) { + for ( i = 0; (bvals != NULL) && (bvals[i] != NULL); i++ ) { rc = value_cmp( (struct berval*)slapi_value_get_berval(bvals[i]), &bvfilter_norm, syntax, 1/* Normalise the first value only */ ); switch ( ftype ) { case LDAP_FILTER_GE: @@ -135,7 +135,7 @@ string_filter_approx( struct berval *bvfilter, Slapi_Value **bvals, if(retVal) { *retVal = NULL; } - for ( i = 0; bvals[i] != NULL; i++ ) { + for ( i = 0; (bvals != NULL) && (bvals[i] != NULL); i++ ) { w2 = (char*)slapi_value_get_string(bvals[i]); /* JCM cast */ ava_wordcount = 0; /* for each word in the filter value */ @@ -310,7 +310,7 @@ string_filter_sub( Slapi_PBlock *pb, char *initial, char **any, char *final, rc = -1; tmpbuf = NULL; tmpbufsize = 0; - for ( j = 0; bvals[j] != NULL; j++ ) { + for ( j = 0; (bvals != NULL) && (bvals[j] != NULL); j++ ) { int tmprc; size_t len; const struct berval *bvp = slapi_value_get_berval(bvals[j]); |