Skip to content

Commit 512caf0

Browse files
authored
explicitly cast uint to int to avoid error (#1306)
Explicitly cast an unsigned int to an int before comparing with an int. This avoids compilation issues when -Werror is in use. Signed-off-by: Glen Gibb <[email protected]>
1 parent c0ff3ab commit 512caf0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/BMI/bmi_interface.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*
1919
*/
2020

21+
#include <assert.h>
22+
#include <limits.h>
2123
#include <string.h>
2224
#include <stdlib.h>
2325
#include <stdio.h>
@@ -171,6 +173,8 @@ int bmi_interface_recv_with_copy(bmi_interface_t *bmi, char *data, int max_len)
171173
pcap_dump_flush(bmi->pcap_input_dumper);
172174
}
173175

176+
assert(pkt_header->len < INT_MAX);
177+
int pkt_header_len = (int)pkt_header->len;
174178
rv = (max_len < pkt_header->len) ? max_len : pkt_header->len;
175179

176180
memcpy(data, pkt_data, rv);

0 commit comments

Comments
 (0)