Skip to content

Commit 1980322

Browse files
author
Felipe Zimmerle
committed
Improves #927 by checking earlier if the string is empty or not
1 parent 7ba07bd commit 1980322

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

apache2/persist_dbm.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,10 @@ int collections_remove_stale(modsec_rec *msr, const char *col_name) {
626626
*/
627627
rc = apr_sdbm_firstkey(dbm, &key);
628628
while(rc == APR_SUCCESS) {
629-
char *s = apr_pstrmemdup(msr->mp, key.dptr, strlen(key.dptr));
630-
*(char **)apr_array_push(keys_arr) = s;
629+
if (key.dsize) {
630+
char *s = apr_pstrmemdup(msr->mp, key.dptr, key.dsize - 1);
631+
*(char **)apr_array_push(keys_arr) = s;
632+
}
631633
rc = apr_sdbm_nextkey(dbm, &key);
632634
}
633635
apr_sdbm_unlock(dbm);

0 commit comments

Comments
 (0)