saait

Simple static page generator
git clone https://git.sinitax.com/codemadness/saait
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit 66bae484ec19ebad289b59b9250cfb726899cda5
parent 48eaa7dac60dfd491fdb1e915f59741cf1a19dd0
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun,  5 Apr 2020 12:59:52 +0200

fix NULL dereference if a template has no blocks + tiny style fix

Diffstat:
Msaait.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/saait.c b/saait.c @@ -483,8 +483,8 @@ main(int argc, char *argv[]) path, ir->d_name); exit(1); } - b->data = readfile(file); b->name = estrdup(file); + b->data = readfile(file); } closedir(idir); } @@ -564,8 +564,9 @@ main(int argc, char *argv[]) fclose(templates[j].fp); } else { b = &templates[j].blocks[BlockItem]; - writepage(templates[j].fp, b->name, argv[i], c, - b->data); + if (b->name) + writepage(templates[j].fp, b->name, + argv[i], c, b->data); } } freevars(c);