Skip to content

Commit

Permalink
Improves #927 by checking earlier if the string is empty or not
Browse files Browse the repository at this point in the history
  • Loading branch information
Felipe Zimmerle committed Oct 26, 2015
1 parent 7ba07bd commit 1980322
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apache2/persist_dbm.c
Expand Up @@ -626,8 +626,10 @@ int collections_remove_stale(modsec_rec *msr, const char *col_name) {
*/
rc = apr_sdbm_firstkey(dbm, &key);
while(rc == APR_SUCCESS) {
char *s = apr_pstrmemdup(msr->mp, key.dptr, strlen(key.dptr));
*(char **)apr_array_push(keys_arr) = s;
if (key.dsize) {
char *s = apr_pstrmemdup(msr->mp, key.dptr, key.dsize - 1);
*(char **)apr_array_push(keys_arr) = s;
}
rc = apr_sdbm_nextkey(dbm, &key);
}
apr_sdbm_unlock(dbm);
Expand Down

0 comments on commit 1980322

Please sign in to comment.