diff options
| author | Endi S. Dewata <edewata@redhat.com> | 2010-07-12 23:11:42 -0500 |
|---|---|---|
| committer | Noriko Hosoi <nhosoi@redhat.com> | 2010-08-19 13:01:42 -0700 |
| commit | f757387b7e2c04f03bc7c1b87c78c64b8f12b59a (patch) | |
| tree | 807a364c47e67ef918a6edddeaf0b93ddcc3d4ca /ldap/servers/plugins/replication | |
| parent | 2eafb258f73a531bad95e845ea3f1d5175e94453 (diff) | |
| download | ds-f757387b7e2c04f03bc7c1b87c78c64b8f12b59a.tar.gz ds-f757387b7e2c04f03bc7c1b87c78c64b8f12b59a.tar.xz ds-f757387b7e2c04f03bc7c1b87c78c64b8f12b59a.zip | |
Bug 614511 - fix coverify Defect Type: Null pointer dereferences issues 11846 - 11891
https://bugzilla.redhat.com/show_bug.cgi?id=614511
Resolves: bug 614511
Bug description: Fix coverify Defect Type: Null pointer dereferences issues 11846 - 11891
description: Catch possible NULL pointer in ruv_covers_ruv() and get_ruvelement_from_berval().
Diffstat (limited to 'ldap/servers/plugins/replication')
| -rw-r--r-- | ldap/servers/plugins/replication/repl5_ruv.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/ldap/servers/plugins/replication/repl5_ruv.c b/ldap/servers/plugins/replication/repl5_ruv.c index f71032a9..9dd512a7 100644 --- a/ldap/servers/plugins/replication/repl5_ruv.c +++ b/ldap/servers/plugins/replication/repl5_ruv.c @@ -1146,16 +1146,8 @@ ruv_covers_ruv(const RUV *covering_ruv, const RUV *covered_ruv) int cookie; /* compare replica generations first */ - if (covering_ruv->replGen == NULL) - { - if (covered_ruv->replGen) - return PR_FALSE; - } - else - { - if (covered_ruv->replGen == NULL) - return PR_FALSE; - } + if (covering_ruv->replGen == NULL || covered_ruv->replGen == NULL) + return PR_FALSE; if (strcasecmp (covered_ruv->replGen, covering_ruv->replGen)) return PR_FALSE; @@ -1662,9 +1654,15 @@ get_ruvelement_from_berval(const struct berval *bval) char ridbuff [RIDSTR_SIZE]; int i; - if (NULL != bval && NULL != bval->bv_val && - bval->bv_len > strlen(prefix_ruvcsn) && - strncasecmp(bval->bv_val, prefix_ruvcsn, strlen(prefix_ruvcsn)) == 0) + if (NULL == bval || NULL == bval->bv_val || + bval->bv_len <= strlen(prefix_ruvcsn) || + strncasecmp(bval->bv_val, prefix_ruvcsn, strlen(prefix_ruvcsn)) != 0) + { + slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, + "get_ruvelement_from_berval: invalid berval\n"); + goto loser; + } + { unsigned int urlbegin = strlen(prefix_ruvcsn); unsigned int urlend; |
