mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fixed possible buffer overflow in mysqlnd_conn__list_fields.
This commit is contained in:
parent
c200eeeb61
commit
c92c788c85
2 changed files with 7 additions and 4 deletions
|
@ -1074,14 +1074,16 @@ MYSQLND_METHOD(mysqlnd_conn, list_fields)(MYSQLND * conn, const char *table, con
|
|||
|
||||
p = buff;
|
||||
if (table && (table_len = strlen(table))) {
|
||||
memcpy(p, table, MIN(table_len, MYSQLND_MAX_ALLOWED_DB_LEN * 4));
|
||||
p += table_len;
|
||||
size_t to_copy = MIN(table_len, MYSQLND_MAX_ALLOWED_DB_LEN * 4);
|
||||
memcpy(p, table, to_copy);
|
||||
p += to_copy;
|
||||
*p++ = '\0';
|
||||
}
|
||||
|
||||
if (achtung_wild && (wild_len = strlen(achtung_wild))) {
|
||||
memcpy(p, achtung_wild, MIN(wild_len, MYSQLND_MAX_ALLOWED_DB_LEN * 4));
|
||||
p += wild_len;
|
||||
size_t to_copy = MIN(wild_len, MYSQLND_MAX_ALLOWED_DB_LEN * 4);
|
||||
memcpy(p, achtung_wild, to_copy);
|
||||
p += to_copy;
|
||||
*p++ = '\0';
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue