Bugfix: blkmk_init_generation: Fail if scriptsz is longer than we properly handle, rather than creating an invalid block

This commit is contained in:
Luke Dashjr
2014-09-01 20:10:28 +00:00
parent 37ed1a8680
commit d7ce09ca03

View File

@@ -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;