mirror of
https://github.com/vrana/adminer.git
synced 2025-12-30 12:20:47 +01:00
Fix long SQL query crash (bug #2839231)
Use ungreedy regular expressions git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@985 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
@@ -31,7 +31,7 @@ if (!$error && $_POST) {
|
||||
} elseif (preg_match('(' . preg_quote($delimiter) . '|[\'`"]|/\\*|-- |#|$)', $query, $match, PREG_OFFSET_CAPTURE, $offset)) {
|
||||
if ($match[0][0] && $match[0][0] != $delimiter) {
|
||||
// is not end of a query - find closing part
|
||||
$pattern = ($match[0][0] == "-- " || $match[0][0] == "#" ? '~.*~' : ($match[0][0] == "/*" ? '~.*\\*/~sU' : '~\\G([^\\\\' . $match[0][0] . ']|\\\\.)*(' . $match[0][0] . '|$)~s')); //! respect sql_mode NO_BACKSLASH_ESCAPES
|
||||
$pattern = ($match[0][0] == "-- " || $match[0][0] == "#" ? '~.*~' : ($match[0][0] == "/*" ? '~.*\\*/~sU' : '~\\G([^\\\\' . $match[0][0] . ']|\\\\.)*(' . $match[0][0] . '|$)~sU')); //! respect sql_mode NO_BACKSLASH_ESCAPES
|
||||
preg_match($pattern, $query, $match, PREG_OFFSET_CAPTURE, $match[0][1] + 1);
|
||||
$offset = $match[0][1] + strlen($match[0][0]);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user