Improves #927 by checking earlier if the string is empty or not

This commit is contained in:
Felipe Zimmerle 2015-10-26 13:49:05 -03:00
parent 7ba07bd547
commit 198032208a

View File

@ -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);