Safeguard against bad arguments (no crash upon NULL)

This commit is contained in:
Holger Vogt 2023-05-17 10:08:38 +02:00
parent ba7ad783a8
commit b24c613ce6
1 changed files with 5 additions and 0 deletions

View File

@ -1112,6 +1112,11 @@ INPparseNode *PT_mkfnode(const char *fname, INPparseNode * arg)
return mkfirst(NULL, arg);
}
if (!arg) {
fprintf(stderr, "Error: bad function arguments \n");
return mkfirst(NULL, arg);
}
/* Make sure the case is ok. */
(void)strncpy(buf, fname, 127);
buf[127] = 0;