diff --git a/sql/field.cc b/sql/field.cc
index 0804797c1eb505beca89ffb4524ab72853a7dcf9..dbf285c6973c657cc7d5240958119df4928e803f 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4786,16 +4786,10 @@ int Field_enum::store(const char *from,uint length,CHARSET_INFO *cs)
     if (length < 6)			// Can't be more than 99999 enums
     {
       /* This is for reading numbers with LOAD DATA INFILE */
-      char buff[7], *end;
-      const char *conv=from;
-      if (from[length])
-      {
-	strmake(buff, from, length);
-	conv=buff;
-      }
+      char *end;
       my_errno=0;
-      tmp=(uint) strtoul(conv,&end,10);
-      if (my_errno || end != conv+length || tmp > typelib->count)
+      tmp=(uint) my_strntoul(cs,from,length,&end,10);
+      if (my_errno || end != from+length || tmp > typelib->count)
       {
 	tmp=0;
 	current_thd->cuted_fields++;
@@ -4990,16 +4984,10 @@ int Field_set::store(const char *from,uint length,CHARSET_INFO *cs)
   if (!tmp && length && length < 22)
   {
     /* This is for reading numbers with LOAD DATA INFILE */
-    char buff[22], *end;
-    const char *conv=from;
-    if (from[length])
-    {
-      strmake(buff, from, length);
-      conv=buff;
-    }
+    char *end;
     my_errno=0;
-    tmp=strtoull(conv,&end,10);
-    if (my_errno || end != conv+length ||
+    tmp=my_strntoull(cs,from,length,&end,10);
+    if (my_errno || end != from+length ||
 	tmp > (ulonglong) (((longlong) 1 << typelib->count) - (longlong) 1))
     {
       tmp=0;
diff --git a/sql/item.cc b/sql/item.cc
index f21cd0fc0f3e981bdeaf33ee61497453ad9ad6f7..568ad74a631319572ba91d1ba244c36fbb2a2b3e 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -395,7 +395,7 @@ longlong Item_param::val_int()
 { 
  switch (item_result_type) {
   case STRING_RESULT:
-    return strtoll(str_value.ptr(),(char**) 0,10);
+    return my_strntoll(str_value.charset(),str_value.ptr(),str_value.length(),(char**) 0,10);
   case REAL_RESULT:
     return (longlong) (real_value+(real_value > 0 ? 0.5 : -0.5));
   default: