Skip to content

Commit 102c64e

Browse files
committed
Add explicit cast to uint32_t.
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.
1 parent 99f3e0f commit 102c64e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ext/mysqlnd/mysqlnd_wireprotocol.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ php_mysqlnd_greet_read(void * _packet)
392392
packet->server_capabilities = uint2korr(p);
393393
p+= 2;
394394
BAIL_IF_NO_MORE_DATA;
395+
DBG_INF_FMT("4.1 server_caps=%u\n", (uint32_t) packet->server_capabilities);
395396

396397
packet->charset_no = uint1korr(p);
397398
p++;
@@ -421,7 +422,8 @@ php_mysqlnd_greet_read(void * _packet)
421422
p--;
422423

423424
/* Additional 16 bits for server capabilities */
424-
packet->server_capabilities |= uint2korr(pad_start) << 16;
425+
DBG_INF_FMT("additional 5.5+ caps=%u\n", (uint32_t) uint2korr(pad_start));
426+
packet->server_capabilities |= ((uint32_t) uint2korr(pad_start)) << 16;
425427
/* And a length of the server scramble in one byte */
426428
packet->authentication_plugin_data.l = uint1korr(pad_start + 2);
427429
if (packet->authentication_plugin_data.l > SCRAMBLE_LENGTH) {

0 commit comments

Comments
 (0)