Skip to content

Commit

Permalink
net: websockets: Fix implicit type conversion Coverity warning
Browse files Browse the repository at this point in the history
Coverity reported potential issues with implicit signed/unsigned type
conversions and potential problems with this. Fix this, by casing the
byte-shifted data variable to uint64_t type explicitly.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
  • Loading branch information
rlubos authored and nashif committed Jun 7, 2023
1 parent e5aa433 commit f9a818c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion subsys/net/lib/websocket/websocket.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ static int websocket_parse(struct websocket_context *ctx, struct websocket_buffe
break;
case WEBSOCKET_PARSER_STATE_EXT_LEN:
ctx->parser_remaining--;
ctx->message_len |= (data << (ctx->parser_remaining * 8));
ctx->message_len |= ((uint64_t)data << (ctx->parser_remaining * 8));
if (ctx->parser_remaining == 0) {
if (ctx->masked) {
ctx->masking_value = 0;
Expand Down

0 comments on commit f9a818c

Please sign in to comment.