Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ PHP NEWS
. Fixed bug GH-24293 (Segfault on connect with an empty password to a
MariaDB PAM account). (lazerg)

- ODBC:
. Fixed bug GH-24736 (php_odbc_connstr_is_quoted() treats a value with no
closing brace as quoted). (lazerg)

- Opcache:
. Fixed tracing JIT returning a wrapped integer instead of a float on
integer overflow after an integer was compared with a float or
Expand Down
20 changes: 20 additions & 0 deletions ext/odbc/tests/gh24736.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--TEST--
GH-24736 (Connection string value without closing brace treated as quoted)
--EXTENSIONS--
odbc
--FILE--
<?php
var_dump(odbc_connection_string_is_quoted("{;Trusted_Connection=yes;UID=x"));
var_dump(odbc_connection_string_is_quoted("{"));
var_dump(odbc_connection_string_is_quoted("{foo}}"));
var_dump(odbc_connection_string_is_quoted("{foo}"));
var_dump(odbc_connection_string_is_quoted("{foo}}}"));
var_dump(odbc_connection_string_is_quoted("{}"));
?>
--EXPECT--
bool(false)
bool(false)
bool(false)
bool(true)
bool(true)
bool(true)
9 changes: 5 additions & 4 deletions main/php_odbc_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@ PHPAPI bool php_odbc_connstr_is_quoted(const char *str)
if (str[i] == '}' && str[i + 1] == '}') {
/* Skip over so we don't count it again */
i++;
} else if (str[i] == '}' && str[i + 1] != '\0') {
/* If not at the end, not quoted */
return false;
} else if (str[i] == '}') {
/* Only quoted if at the end */
return str[i + 1] == '\0';
}
}
return true;
/* No closing brace */
return false;
}

/**
Expand Down
Loading