Skip to content

Commit

Permalink
Fix invalid efree in browscap
Browse files Browse the repository at this point in the history
Related to bug #77338.
  • Loading branch information
nikic committed Dec 23, 2018
1 parent 8db63ad commit 64de5bc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ext/standard/browscap.c
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ PHP_FUNCTION(get_browser)
found_entry = zend_hash_str_find_ptr(bdata->htab,
DEFAULT_SECTION_NAME, sizeof(DEFAULT_SECTION_NAME)-1);
if (found_entry == NULL) {
efree(lookup_browser_name);
zend_string_release(lookup_browser_name);
RETURN_FALSE;
}
}
Expand Down
2 changes: 2 additions & 0 deletions ext/standard/tests/misc/browscap_no_default.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Firefox]
Browser="Firefox"
12 changes: 12 additions & 0 deletions ext/standard/tests/misc/get_browser_no_default.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--TEST--
get_browser() without a default
--INI--
browscap={PWD}/browscap_no_default.ini
--FILE--
<?php

var_dump(get_browser(""));

?>
--EXPECT--
bool(false)

0 comments on commit 64de5bc

Please sign in to comment.