diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2015-02-16 14:55:48 +0100 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2015-02-16 14:55:48 +0100 |
commit | aff96bf116c07d0e513be84648e31fc0bcc34567 (patch) | |
tree | 5cf80d0f152ceeca892dce04e30bf7c0f2450ba9 | |
parent | d4c816135ef7acaa03f303b2902734d766f93b01 (diff) |
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 <tklauser@distanz.ch>
-rw-r--r-- | pkt.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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 { |