You've already forked mariadb-connector-c
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user