1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-08 14:02:17 +03:00

Fix for MDEV-14165:

- The metadata length value for a column with a zerofill flag was calculated with a fixed length instead of using the reported length.
- fixed a possible stackoverflow, if the display width for a column with zerofill flag is greater then 22. (libmysql ps implementation truncates the result after 21 digits and reports truncation error).
This commit is contained in:
Georg Richter
2017-10-28 16:46:49 +02:00
parent 0db59d2b10
commit e42dd6c0e0
3 changed files with 66 additions and 3 deletions

View File

@@ -242,8 +242,16 @@ int mthd_stmt_read_all_rows(MYSQL_STMT *stmt)
}
else
{
if (!stmt->fields[i].max_length)
if (stmt->fields[i].flags & ZEROFILL_FLAG)
{
size_t len= MAX(stmt->fields[i].length, mysql_ps_fetch_functions[stmt->fields[i].type].max_len);
if (len > stmt->fields[i].max_length)
stmt->fields[i].max_length= len;
}
else if (!stmt->fields[i].max_length)
{
stmt->fields[i].max_length= mysql_ps_fetch_functions[stmt->fields[i].type].max_len;
}
cp+= mysql_ps_fetch_functions[stmt->fields[i].type].pack_len;
}
}