From aff96bf116c07d0e513be84648e31fc0bcc34567 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 16 Feb 2015 14:55:48 +0100 Subject: plt: Fix packet length check in pkt_put() pkt_len() return the amount of bytes the packet currently holds. Together with the newly added bytes it mustn't exceed p->size. Signed-off-by: Tobias Klauser --- pkt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkt.h b/pkt.h index 5b8640c..cd08a50 100644 --- a/pkt.h +++ b/pkt.h @@ -72,7 +72,7 @@ static inline uint8_t *pkt_put(struct pkt *p, size_t len) assert(pkt_invariant(p)); - if (len <= pkt_len(p)) { + if (pkt_len(p) + len <= p->size) { data = p->tail; p->tail += len; } else { -- cgit v1.2.3-54-g00ecf