mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
- Fix length when TYPVAL::SetValue_char is called from MYSQLCOL::ReadColumn.
modified: storage/connect/tabmysql.cpp storage/connect/value.cpp
This commit is contained in:
parent
9bd94d7f7e
commit
81e5c5db3b
2 changed files with 5 additions and 5 deletions
|
@ -1232,7 +1232,7 @@ void MYSQLCOL::ReadColumn(PGLOBAL g)
|
|||
if (trace)
|
||||
htrc("MySQL ReadColumn: name=%s buf=%s\n", Name, buf);
|
||||
|
||||
Value->SetValue_char(buf, Long);
|
||||
Value->SetValue_char(buf, min((unsigned)Long, strlen(buf)));
|
||||
} else {
|
||||
if (Nullable)
|
||||
Value->SetNull(true);
|
||||
|
|
|
@ -579,12 +579,12 @@ template <>
|
|||
void TYPVAL<double>::SetValue_char(char *p, int n)
|
||||
{
|
||||
if (p) {
|
||||
char *p2, buf[32];
|
||||
char buf[32];
|
||||
|
||||
for (p2 = p + n; p < p2 && *p == ' '; p++) ;
|
||||
for (; n > 0 && *p == ' '; p++)
|
||||
n--;
|
||||
|
||||
n = min(p2 - p, 31);
|
||||
memcpy(buf, p, n);
|
||||
memcpy(buf, p, min(n, 31));
|
||||
buf[n] = '\0';
|
||||
Tval = atof(buf);
|
||||
|
||||
|
|
Loading…
Reference in a new issue