Skip to content

Commit

Permalink
Issue 4884 - server crashes when dnaInterval attribute is set to zero
Browse files Browse the repository at this point in the history
Bug Description:

A division by zero crash occurs if the dnaInterval is set to zero

Fix Description:

Validate the config value of dnaInterval and adjust it to the
default/safe value of "1" if needed.

relates: #4884

Reviewed by: tbordaz(Thanks!)
  • Loading branch information
mreynolds389 committed Aug 26, 2021
1 parent 1612466 commit 38e1e26
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ldap/servers/plugins/dna/dna.c
Expand Up @@ -1025,7 +1025,14 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry *e, int apply)

value = slapi_entry_attr_get_charptr(e, DNA_INTERVAL);
if (value) {
errno = 0;
entry->interval = strtoull(value, 0, 0);
if (entry->interval == 0 || errno == ERANGE) {
slapi_log_err(SLAPI_LOG_WARNING, DNA_PLUGIN_SUBSYSTEM,
"dna_parse_config_entry - Invalid value for dnaInterval (%s), "
"Using default value of 1\n", value);
entry->interval = 1;
}
slapi_ch_free_string(&value);
}

Expand Down

0 comments on commit 38e1e26

Please sign in to comment.