diff options
author | Noriko Hosoi <nhosoi@redhat.com> | 2010-08-23 11:16:19 -0700 |
---|---|---|
committer | Noriko Hosoi <nhosoi@redhat.com> | 2010-08-23 11:16:19 -0700 |
commit | 2daecd99e1150c8c98e9bc497691ecb0ab7da252 (patch) | |
tree | 4c8de94ef4fb3149542373cfac098268a748955e | |
parent | c606cfcecb3d3403dfd3d1a90bd1d2b061eb3b6e (diff) | |
download | ds-2daecd99e1150c8c98e9bc497691ecb0ab7da252.tar.gz ds-2daecd99e1150c8c98e9bc497691ecb0ab7da252.tar.xz ds-2daecd99e1150c8c98e9bc497691ecb0ab7da252.zip |
Bug 610119 - fix coverify Defect Type: Null pointer dereferences issues 12167 - 12199
https://bugzilla.redhat.com/show_bug.cgi?id=610119
Resolves: bug 610119
Bug description: Fix coverify Defect Type: Null pointer dereferences issues 12167 - 12199
Fix description: Catch possible NULL pointer in index_range_read().
-rw-r--r-- | ldap/servers/slapd/back-ldbm/index.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/ldap/servers/slapd/back-ldbm/index.c b/ldap/servers/slapd/back-ldbm/index.c index 49b967b4..73275fcb 100644 --- a/ldap/servers/slapd/back-ldbm/index.c +++ b/ldap/servers/slapd/back-ldbm/index.c @@ -1135,6 +1135,13 @@ index_range_read( int sizelimit = 0; time_t curtime, stoptime, optime; int timelimit = -1; + back_search_result_set *sr = NULL; + + if (!pb) { + LDAPDebug(LDAP_DEBUG_ANY, "index_range_read: NULL pblock\n", + 0, 0, 0); + return NULL; + } *err = 0; @@ -1156,22 +1163,18 @@ index_range_read( /* * Determine the lookthrough_limit from the PBlock. - * No limit if there is no PBlock supplied or if there is no - * search result set and the requestor is root. + * No limit if there is no search result set and the requestor is root. */ - if (pb != NULL) { - back_search_result_set *sr = NULL; - slapi_pblock_get( pb, SLAPI_SEARCH_RESULT_SET, &sr ); - if (sr != NULL) { - /* the normal case */ - lookthrough_limit = sr->sr_lookthroughlimit; - } else { - int isroot = 0; - slapi_pblock_get( pb, SLAPI_REQUESTOR_ISROOT, &isroot ); - if (!isroot) { - lookthrough_limit = li->li_lookthroughlimit; - } + slapi_pblock_get( pb, SLAPI_SEARCH_RESULT_SET, &sr ); + if (sr != NULL) { + /* the normal case */ + lookthrough_limit = sr->sr_lookthroughlimit; + } else { + int isroot = 0; + slapi_pblock_get( pb, SLAPI_REQUESTOR_ISROOT, &isroot ); + if (!isroot) { + lookthrough_limit = li->li_lookthroughlimit; } } |