From d7ce09ca03d3e42fb280f585ffda02fa1a993dbb Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 1 Sep 2014 20:10:28 +0000 Subject: [PATCH] Bugfix: blkmk_init_generation: Fail if scriptsz is longer than we properly handle, rather than creating an invalid block --- blkmaker.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/blkmaker.c b/blkmaker.c index 68be029..ac04594 100644 --- a/blkmaker.c +++ b/blkmaker.c @@ -52,6 +52,9 @@ uint64_t blkmk_init_generation2(blktemplate_t *tmpl, void *script, size_t script if (out_newcb) *out_newcb = true; + if (scriptsz >= 0xfd) + return 0; + size_t datasz = 62 + sizeof(blkheight_t) + scriptsz; unsigned char *data = malloc(datasz); size_t off = 0;