Add explicit cast to uint32_t.
authorAndrey Hristov <andrey@php.net>
Fri, 21 Jun 2019 13:30:25 +0000 (16:30 +0300)
committerAndrey Hristov <andrey@php.net>
Fri, 21 Jun 2019 13:31:56 +0000 (16:31 +0300)
It works even without it but explicit stuff is better. The compiler probably converts the 16-bit
uint16_t to uint32_t before doing the shift.

ext/mysqlnd/mysqlnd_wireprotocol.c

index b9cbb1789429cf8ab7d4abc5d2ea1219dd596276..7616540e4f6264c12c6b44c7d87d53678ef77319 100644 (file)
@@ -392,6 +392,7 @@ php_mysqlnd_greet_read(void * _packet)
        packet->server_capabilities = uint2korr(p);
        p+= 2;
        BAIL_IF_NO_MORE_DATA;
+       DBG_INF_FMT("4.1 server_caps=%u\n", (uint32_t) packet->server_capabilities);
 
        packet->charset_no = uint1korr(p);
        p++;
@@ -421,7 +422,8 @@ php_mysqlnd_greet_read(void * _packet)
                p--;
 
        /* Additional 16 bits for server capabilities */
-               packet->server_capabilities |= uint2korr(pad_start) << 16;
+               DBG_INF_FMT("additional 5.5+ caps=%u\n", (uint32_t) uint2korr(pad_start));
+               packet->server_capabilities |= ((uint32_t) uint2korr(pad_start)) << 16;
                /* And a length of the server scramble in one byte */
                packet->authentication_plugin_data.l = uint1korr(pad_start + 2);
                if (packet->authentication_plugin_data.l > SCRAMBLE_LENGTH) {