fix NULL dereference if a template has no blocks + tiny style fix - saait - the… | |
git clone git://git.codemadness.org/saait | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 66bae484ec19ebad289b59b9250cfb726899cda5 | |
parent 48eaa7dac60dfd491fdb1e915f59741cf1a19dd0 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Sun, 5 Apr 2020 12:59:52 +0200 | |
fix NULL dereference if a template has no blocks + tiny style fix | |
Diffstat: | |
M saait.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); |