Skip to content
This repository was archived by the owner on Mar 4, 2024. It is now read-only.

Commit a35e1f0

Browse files
author
Mathieu Borderé
committed
uv_encoding: Check message->type overflow.
1 parent 3e7b82d commit a35e1f0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/uv_encoding.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "uv_encoding.h"
22

3+
#include <limits.h>
34
#include <string.h>
45

56
#include "../include/raft/uv.h"
@@ -481,7 +482,10 @@ int uvDecodeMessage(const unsigned long type,
481482
unsigned i;
482483
int rv = 0;
483484

484-
/* TODO: check type overflow */
485+
if (type > USHRT_MAX) {
486+
return RAFT_INVALID;
487+
}
488+
485489
message->type = (unsigned short)type;
486490

487491
*payload_len = 0;

0 commit comments

Comments
 (0)