From 49483a6bbd5862233e6b3cc5b489cfaf7d88c270 Mon Sep 17 00:00:00 2001 From: Baruch Even Date: Mon, 4 Aug 2014 20:53:00 +0300 Subject: [PATCH] Forego updating sz in capn_write_mem It is not used and we already validated the total buffer size beforehand. --- capn-malloc.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/capn-malloc.c b/capn-malloc.c index eea040a..2032ba7 100644 --- a/capn-malloc.c +++ b/capn-malloc.c @@ -205,14 +205,10 @@ capn_write_mem(struct capn *c, uint8_t *p, size_t sz, int packed) return -1; p += 4 * headerlen; - sz -= 4 * headerlen; for (seg = root.seg; seg; seg = seg->next) { - if (sz < seg->len) - return -1; memcpy(p, seg->data, seg->len); p += seg->len; - sz -= seg->len; } return datasz;