fix compiler warnings: C23 label+declaration, uint16_t overflow check
This commit is contained in:
1 parent
7c71ef683c
commit
2144eea46f
2 files changed
+6
-4
No files matched your search
+2
-2
@@ -71,8 +71,8 @@ static void feed_dgram_to_asm(struct ETCP_CONN* etcp, struct PKTNORM* pn,
|
||||
uint8_t* dgram, uint16_t dgram_len,
|
||||
uint8_t** asm_buf, uint16_t* asm_len, uint16_t* asm_cap,
|
||||
uint32_t* returned) {
|
||||
uint16_t need = *asm_len + dgram_len;
|
||||
if (need > ASM_BUF_MAX_SIZE) {
|
||||
uint32_t need = (uint32_t)*asm_len + dgram_len;
|
||||
if (need >= ASM_BUF_MAX_SIZE) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_ETCP, "[%s] assembly buffer would exceed max size %d", etcp->log_name, ASM_BUF_MAX_SIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -543,6 +543,8 @@ static uint16_t tcp_new_port(struct tcp_pcb *pcb)
|
||||
{
|
||||
struct lwip_tcp_ctx *ctx = pcb->ctx;
|
||||
uint16_t n = 0;
|
||||
struct tcp_pcb *lists[4];
|
||||
int i;
|
||||
|
||||
ctx->port_seed++;
|
||||
if (ctx->port_seed < TCP_LOCAL_PORT_RANGE_START || ctx->port_seed >= TCP_LOCAL_PORT_RANGE_END) {
|
||||
@@ -550,8 +552,8 @@ static uint16_t tcp_new_port(struct tcp_pcb *pcb)
|
||||
}
|
||||
|
||||
again:
|
||||
struct tcp_pcb *lists[4] = { ctx->listen_pcbs, ctx->bound_pcbs, ctx->active_pcbs, ctx->tw_pcbs };
|
||||
int i;
|
||||
lists[0] = ctx->listen_pcbs; lists[1] = ctx->bound_pcbs;
|
||||
lists[2] = ctx->active_pcbs; lists[3] = ctx->tw_pcbs;
|
||||
for (i = 0; i < 4; i++) {
|
||||
struct tcp_pcb *cpcb;
|
||||
for (cpcb = lists[i]; cpcb != NULL; cpcb = cpcb->next) {
|
||||
|
||||
Reference in new issue
Block a user