diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2020-09-16 10:28:28 +0200 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-09-16 10:30:13 +0200 |
| commit | 392f0abf687c7519ba02d7d41b9622f0b3d1a8e2 (patch) | |
| tree | da003292ed7c586f77da90315d59f19b91f14288 /ext/mysqlnd | |
| parent | 3b2410ebf6216733410b3d12566ffba3a99519c7 (diff) | |
| download | php-git-392f0abf687c7519ba02d7d41b9622f0b3d1a8e2.tar.gz | |
Avoid ubsan warning due to memcpy null
This showed up in ext/mysqli/tests/mysqli_change_user.phpt on azure
today. Not seeing it locally though, and also not sure why it decided
to show up now...
Diffstat (limited to 'ext/mysqlnd')
| -rw-r--r-- | ext/mysqlnd/mysqlnd_wireprotocol.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c index ab7fc61f94..515526d11d 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.c +++ b/ext/mysqlnd/mysqlnd_wireprotocol.c @@ -2144,7 +2144,9 @@ size_t php_mysqlnd_cached_sha2_result_write(MYSQLND_CONN_DATA * conn, void * _pa int1store(buffer + MYSQLND_HEADER_SIZE, '\2'); sent = pfc->data->m.send(pfc, vio, buffer, 1, stats, error_info); } else { - memcpy(buffer + MYSQLND_HEADER_SIZE, packet->password, packet->password_len); + if (packet->password_len != 0) { + memcpy(buffer + MYSQLND_HEADER_SIZE, packet->password, packet->password_len); + } sent = pfc->data->m.send(pfc, vio, buffer, packet->password_len, stats, error_info); } |
