- Fix pythonmod script read for numeric overflow.

This commit is contained in:
W.C.A. Wijngaards
2026-06-10 11:24:02 +02:00
parent e7a713a525
commit db1c6d6557
2 changed files with 9 additions and 0 deletions
+6
View File
@@ -491,6 +491,12 @@ int pythonmod_init(struct module_env* env, int id)
/* print the error to logs too, run it again */
fseek(script_py, 0, SEEK_END);
flen = (size_t)ftell(script_py);
#ifdef SIZE_MAX
if(flen > SIZE_MAX-2) {
log_err("script file too large");
goto fail_close_file;
}
#endif
fstr = malloc(flen+1);
if(!fstr) {
log_err("malloc failure to print parse error");