Skip to content

Commit

Permalink
Fixed segfault reported by PR #29
Browse files Browse the repository at this point in the history
  • Loading branch information
laruence committed Feb 18, 2020
1 parent 738f5e4 commit 3d905e5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions yaconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ static void php_yaconf_ini_parser_cb(zval *key, zval *value, zval *index, int ca
while (*(section) == ' ' || *(section) == ':') {
*(section++) = '\0';
}
if ((parent = zend_symtable_str_find(Z_ARRVAL_P(arr), section, strlen(section)))) {
if ((parent = zend_symtable_str_find(Z_ARRVAL_P(arr), section, strlen(section))) && Z_TYPE_P(parent) == IS_ARRAY) {
php_yaconf_hash_copy(Z_ARRVAL(active_ini_file_section), Z_ARRVAL_P(parent));
}
} while ((section = strrchr(seg, ':')));
Expand All @@ -379,7 +379,7 @@ static void php_yaconf_ini_parser_cb(zval *key, zval *value, zval *index, int ca
*(section--) = '\0';
}

if ((parent = zend_symtable_str_find(Z_ARRVAL_P(arr), seg, strlen(seg)))) {
if ((parent = zend_symtable_str_find(Z_ARRVAL_P(arr), seg, strlen(seg))) && Z_TYPE_P(parent) == IS_ARRAY) {
php_yaconf_hash_copy(Z_ARRVAL(active_ini_file_section), Z_ARRVAL_P(parent));
}
}
Expand Down

0 comments on commit 3d905e5

Please sign in to comment.