mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-16 15:57:00 +00:00
output: make mustach processing more robust
Fix issues found with afl-fuzz. It is a pity I had to change mustach.c it is no longer exactly the same as upstream. Lets see if Jose will accept these changes. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
2ec953858b
commit
66183bc7c7
1 changed files with 3 additions and 1 deletions
|
|
@ -38,7 +38,7 @@ static int getpartial(struct mustach_itf *itf, void *closure, const char *name,
|
|||
|
||||
*result = NULL;
|
||||
file = open_memstream(result, &size);
|
||||
if (file == NULL)
|
||||
if (itf->put == NULL || file == NULL)
|
||||
rc = MUSTACH_ERROR_SYSTEM;
|
||||
else {
|
||||
rc = itf->put(closure, name, 0, file);
|
||||
|
|
@ -192,6 +192,8 @@ static int process(const char *template, struct mustach_itf *itf, void *closure,
|
|||
default:
|
||||
/* replacement */
|
||||
if (emit) {
|
||||
if (itf->put == NULL)
|
||||
return MUSTACH_ERROR_SYSTEM;
|
||||
rc = itf->put(closure, name, c != '&', file);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue