From fb7ba99648e4e64c3980052af337f1ac8aa53c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 11 Jan 2006 10:52:45 +0000 Subject: [PATCH] Fix hang on unclosed quoted string (bug #1402270). --- ChangeLog | 2 ++ libraries/import/sql.php | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 75109bb18..14d87bc03 100755 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,8 @@ $Source$ * main.php, libraries/left_header.inc.php, libraries/select_server.lib.php: Show server selection if no server set and we have one server configuration (bug #1399880). + * libraries/import/sql.php: Fix hang on unclosed quoted string (bug + #1402270). 2006-01-10 Marc Delisle * libraries/sqlparser.lib.php: bug #1394479, problem detecting ending diff --git a/libraries/import/sql.php b/libraries/import/sql.php index 337674cc7..bad3193f8 100644 --- a/libraries/import/sql.php +++ b/libraries/import/sql.php @@ -78,7 +78,14 @@ if (isset($plugin_list)) { // Find next quote $pos = strpos($buffer, $quote, $i + 1); // No quote? Too short string - if ($pos === FALSE) break; + if ($pos === FALSE) { + // We hit end of string => unclosed quote, but we handle it as end of query + if ($finished) { + $endq = TRUE; + $i = $len - 1; + } + break; + } // Was not the quote escaped? $j = $pos - 1; while ($buffer[$j] == '\\') $j--;