diff options
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sql/field.cc b/sql/field.cc index 3f74210807b..2950f349580 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -8395,8 +8395,20 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type, (fld_type_modifier & NOT_NULL_FLAG) && fld_type != FIELD_TYPE_TIMESTAMP) flags|= NO_DEFAULT_VALUE_FLAG; - if (fld_length && !(length= (uint) atoi(fld_length))) - fld_length= 0; /* purecov: inspected */ + if (fld_length != 0) + { + errno= 0; + length= strtoul(fld_length, NULL, 10); + if (errno != 0) + { + my_error(ER_TOO_BIG_DISPLAYWIDTH, MYF(0), fld_name, MAX_FIELD_BLOBLENGTH); + DBUG_RETURN(TRUE); + } + + if (length == 0) + fld_length= 0; /* purecov: inspected */ + } + sign_len= fld_type_modifier & UNSIGNED_FLAG ? 0 : 1; switch (fld_type) { |