Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
17d02c5f
Commit
17d02c5f
authored
May 07, 2005
by
jimw@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport fix for escaping multibyte characters. (Bug #9864)
parent
0190878d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
libmysql/libmysql.c
libmysql/libmysql.c
+34
-0
No files found.
libmysql/libmysql.c
View file @
17d02c5f
...
@@ -3228,6 +3228,23 @@ mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
...
@@ -3228,6 +3228,23 @@ mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
from
--
;
from
--
;
continue
;
continue
;
}
}
/*
If the next character appears to begin a multi-byte character, we
escape that first byte of that apparent multi-byte character. (The
character just looks like a multi-byte character -- if it were actually
a multi-byte character, it would have been passed through in the test
above.)
Without this check, we can create a problem by converting an invalid
multi-byte character into a valid one. For example, 0xbf27 is not
a valid GBK character, but 0xbf5c is. (0x27 = ', 0x5c = \)
*/
if
(
use_mb_flag
&&
(
l
=
my_mbcharlen
(
charset_info
,
*
from
))
>
1
)
{
*
to
++=
'\\'
;
*
to
++=
*
from
;
continue
;
}
#endif
#endif
switch
(
*
from
)
{
switch
(
*
from
)
{
case
0
:
/* Must be escaped for 'mysql' */
case
0
:
/* Must be escaped for 'mysql' */
...
@@ -3300,6 +3317,23 @@ mysql_odbc_escape_string(MYSQL *mysql,
...
@@ -3300,6 +3317,23 @@ mysql_odbc_escape_string(MYSQL *mysql,
from
--
;
from
--
;
continue
;
continue
;
}
}
/*
If the next character appears to begin a multi-byte character, we
escape that first byte of that apparent multi-byte character. (The
character just looks like a multi-byte character -- if it were actually
a multi-byte character, it would have been passed through in the test
above.)
Without this check, we can create a problem by converting an invalid
multi-byte character into a valid one. For example, 0xbf27 is not
a valid GBK character, but 0xbf5c is. (0x27 = ', 0x5c = \)
*/
if
(
use_mb_flag
&&
(
l
=
my_mbcharlen
(
mysql
->
charset
,
*
from
))
>
1
)
{
*
to
++=
'\\'
;
*
to
++=
*
from
;
continue
;
}
}
}
#endif
#endif
switch
(
*
from
)
{
switch
(
*
from
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment