summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorGeorgi Kodinov <joro@sun.com>2010-05-05 11:54:52 +0300
committerGeorgi Kodinov <joro@sun.com>2010-05-05 11:54:52 +0300
commitaddd0a3e67164037149140b71c027272ecbaee49 (patch)
tree3e5ae4df9250bbbafbe8258494b8f2b3e1cec431 /sql/item.cc
parented4819bbf7ebeeac1c64d5ea772dd2507af9b1d2 (diff)
downloadmariadb-git-addd0a3e67164037149140b71c027272ecbaee49.tar.gz
On behalf of Kristofer :
Bug#53417 my_getwd() makes assumptions on the buffer sizes which not always hold true The mysys library contains many functions for rewriting file paths. Most of these functions makes implicit assumptions on the buffer sizes they write to. If a path is put in my_realpath() it will propagate to my_getwd() which assumes that the buffer holding the path name is greater than 2. This is not true in cases. In the special case where a VARBIN_ITEM is passed as argument to the LOAD_FILE function this can lead to a crash. This patch fixes the issue by introduce more safe guards agaist buffer overruns.
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 3407d2fecd4..2175a579f4a 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -5366,13 +5366,25 @@ inline uint char_val(char X)
X-'a'+10);
}
+Item_hex_string::Item_hex_string()
+{
+ hex_string_init("", 0);
+}
Item_hex_string::Item_hex_string(const char *str, uint str_length)
{
+ hex_string_init(str, str_length);
+}
+
+void Item_hex_string::hex_string_init(const char *str, uint str_length)
+{
max_length=(str_length+1)/2;
char *ptr=(char*) sql_alloc(max_length+1);
if (!ptr)
+ {
+ str_value.set("", 0, &my_charset_bin);
return;
+ }
str_value.set(ptr,max_length,&my_charset_bin);
char *end=ptr+max_length;
if (max_length*2 != str_length)