diff options
author | Tom Rini <trini@konsulko.com> | 2023-09-22 18:25:37 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-09-22 18:25:37 -0400 |
commit | 4cb31a9f3560b293670de95e76c1f3cf2f9e1ca8 (patch) | |
tree | b32b0d1da40fb08ad70f564da42b39e9ccec9b77 /net/wget.c | |
parent | d01a8541d62d78ad76706617e9f8690c8cb01fb8 (diff) | |
parent | ff6156f0300d3bf77e9d9091a4f1f6f9112d7278 (diff) |
Merge branch '2023-09-22-assorted-bugfixes'
- A few driver fixes and MAINTAINER updates
Diffstat (limited to 'net/wget.c')
-rw-r--r-- | net/wget.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/net/wget.c b/net/wget.c index 2dbfeb1a1d5..8bb4d72db1a 100644 --- a/net/wget.c +++ b/net/wget.c @@ -35,7 +35,8 @@ struct pkt_qd { * The actual packet bufers are in the kernel space, and are * expected to be overwritten by the downloaded image. */ -static struct pkt_qd pkt_q[PKTBUFSRX / 4]; +#define PKTQ_SZ (PKTBUFSRX / 4) +static struct pkt_qd pkt_q[PKTQ_SZ]; static int pkt_q_idx; static unsigned long content_length; static unsigned int packets; @@ -202,6 +203,13 @@ static void wget_connected(uchar *pkt, unsigned int tcp_seq_num, pkt_q[pkt_q_idx].tcp_seq_num = tcp_seq_num; pkt_q[pkt_q_idx].len = len; pkt_q_idx++; + + if (pkt_q_idx >= PKTQ_SZ) { + printf("wget: Fatal error, queue overrun!\n"); + net_set_state(NETLOOP_FAIL); + + return; + } } else { debug_cond(DEBUG_WGET, "wget: Connected HTTP Header %p\n", pkt); /* sizeof(http_eom) - 1 is the string length of (http_eom) */ |