From 150604aa4983f20a200b9f16f5738fd0017368f3 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Sun, 24 Nov 2019 16:52:02 +0100 Subject: typo in _tr_release --- code/ecp/core.c | 4 ---- code/ecp/crypto/Makefile | 2 +- code/ecp/fe310/transport.c | 5 +++++ code/ecp/rbuf_send.c | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) (limited to 'code') diff --git a/code/ecp/core.c b/code/ecp/core.c index 77b7a96..d15dd16 100644 --- a/code/ecp/core.c +++ b/code/ecp/core.c @@ -1370,10 +1370,6 @@ ssize_t ecp_pkt_send(ECPSocket *sock, ECPNetAddr *addr, ECPBuffer *packet, size_ if (rv < 0) return rv; if (rv < ECP_MIN_PKT) return ECP_ERR_SEND; - if (flags & ECP_SEND_FLAG_REPLY) { - packet->buffer = NULL; - packet->size = 0; - } return rv; } diff --git a/code/ecp/crypto/Makefile b/code/ecp/crypto/Makefile index 45a1e2d..6f07ec6 100644 --- a/code/ecp/crypto/Makefile +++ b/code/ecp/crypto/Makefile @@ -19,7 +19,7 @@ all: $(obj) (cd $$i && $(MAKE) && cd ..) || exit; \ done $(AR) rcs libecpcr.a $(obj) $(obj_dep) - + clean: for i in $(subdirs) test; do \ (cd $$i && $(MAKE) clean && cd ..) || exit; \ diff --git a/code/ecp/fe310/transport.c b/code/ecp/fe310/transport.c index a0b4a05..6da5139 100644 --- a/code/ecp/fe310/transport.c +++ b/code/ecp/fe310/transport.c @@ -26,6 +26,11 @@ static void packet_handler(unsigned char *buffer, uint16_t len) { payload.buffer = pld_buf; payload.size = ECP_MAX_PLD; + if ((buffer == NULL) || (len < EOS_SOCK_SIZE_UDP_HDR)) { + eos_net_free(buffer, 0); + return; + } + eos_sock_getfrom(buffer, &addr); ssize_t rv = ecp_pkt_handle(_ecp_tr_sock, &addr, NULL, &bufs, len-EOS_SOCK_SIZE_UDP_HDR); #ifdef ECP_DEBUG diff --git a/code/ecp/rbuf_send.c b/code/ecp/rbuf_send.c index 39fed02..5847744 100644 --- a/code/ecp/rbuf_send.c +++ b/code/ecp/rbuf_send.c @@ -108,7 +108,7 @@ ssize_t ecp_rbuf_handle_ack(ECPConnection *conn, ecp_seq_t seq, unsigned char mt (msg[6] << 8) | \ (msg[7]); - eos_tr_release(b->packet, 1); + ecp_tr_release(b->packet, 1); ecp_tr_flag_set(ECP_SEND_FLAG_MORE); #ifdef ECP_WITH_PTHREAD @@ -203,7 +203,7 @@ ssize_t ecp_rbuf_handle_ack(ECPConnection *conn, ecp_seq_t seq, unsigned char mt } ecp_tr_flag_clear(ECP_SEND_FLAG_MORE); - eos_tr_release(b->packet, 0); + ecp_tr_release(b->packet, 0); if (rv) return rv; return rsize; -- cgit v1.2.3