diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-09-23 12:42:30 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-09-23 12:42:30 +0300 |
commit | 70960bd33d2699bc96821ec0a0381ca6de86e93e (patch) | |
tree | dd0275d3e96c80ecbb76102ce4fbbea22002655c /sql-common/client.c | |
parent | af40a2b43e94cab6b25c9efe4b18c3112b4a9e6c (diff) | |
download | mariadb-git-70960bd33d2699bc96821ec0a0381ca6de86e93e.tar.gz |
UBSAN: Fix a bit shift overflow
Shifting a 16-bit type by 16 bits is undefined behaviour.
The result is at least 32 bits, so let us cast the shift operand
to a wider type before shifting.
Diffstat (limited to 'sql-common/client.c')
-rw-r--r-- | sql-common/client.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql-common/client.c b/sql-common/client.c index b66eee2a508..ff36b757957 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1,5 +1,5 @@ /* Copyright (c) 2003, 2016, Oracle and/or its affiliates. - Copyright (c) 2009, 2017, MariaDB + Copyright (c) 2009, 2020, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -3295,7 +3295,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, /* New protocol with 16 bytes to describe server characteristics */ mysql->server_language=end[2]; mysql->server_status=uint2korr(end+3); - mysql->server_capabilities|= uint2korr(end+5) << 16; + mysql->server_capabilities|= ((unsigned) uint2korr(end+5)) << 16; pkt_scramble_len= end[7]; if (pkt_scramble_len < 0) { |