1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-4664 mysql_upgrade crashes if root's password contains an apostrophe/single quotation mark

fix dynstr_append_os_quoted() to escape single quotes correctly
for a POSIX shell
This commit is contained in:
Sergei Golubchik
2016-02-06 13:57:59 +01:00
parent 9e4e4121b8
commit 1e361f286b
2 changed files with 8 additions and 7 deletions

View File

@ -47,25 +47,25 @@ int main(void)
check("'space inside'");
ok(dynstr_append_os_quoted(&str1, "single'quote", NULL) == 0, "append");
check("'single\\'quote'");
check("'single'\"'\"'quote'");
ok(dynstr_append_os_quoted(&str1, "many'single'quotes", NULL) == 0, "append");
check("'many\\'single\\'quotes'");
check("'many'\"'\"'single'\"'\"'quotes'");
ok(dynstr_append_os_quoted(&str1, "'single quoted'", NULL) == 0, "append");
check("'\\'single quoted\\''");
check("''\"'\"'single quoted'\"'\"''");
ok(dynstr_append_os_quoted(&str1, "double\"quote", NULL) == 0, "append");
check("'double\"quote'");
ok(dynstr_append_os_quoted(&str1, "mixed\"single'and\"double'quotes", NULL) == 0, "append");
check("'mixed\"single\\'and\"double\\'quotes'");
check("'mixed\"single'\"'\"'and\"double'\"'\"'quotes'");
ok(dynstr_append_os_quoted(&str1, "back\\space", NULL) == 0, "append");
check("'back\\space'");
ok(dynstr_append_os_quoted(&str1, "backspace\\'and\\\"quote", NULL) == 0, "append");
check("'backspace\\\\'and\\\"quote'");
check("'backspace\\'\"'\"'and\\\"quote'");
dynstr_free(&str1);