From: Donald Sharp Date: Sun, 24 Jan 2021 12:52:55 +0000 (-0500) Subject: lib: Prevent possible memory overwrite X-Git-Tag: base_8.0~475^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=833c1f9fd14c4764b9f36f5e61c57130ff4f7118;p=mirror%2Ffrr.git lib: Prevent possible memory overwrite fname is MAXPATHLEN and scriptdir and fs->name are less then MAXPATHLEN but the combination of those two + the `.lua` are greater than the MAXPATHLEN. Just give us more room to prevent a coding boo boo. Signed-off-by: Donald Sharp --- diff --git a/lib/frrscript.c b/lib/frrscript.c index a3de474a4e..a43f389f99 100644 --- a/lib/frrscript.c +++ b/lib/frrscript.c @@ -208,7 +208,7 @@ struct frrscript *frrscript_load(const char *name, fs->L = luaL_newstate(); frrlua_export_logging(fs->L); - char fname[MAXPATHLEN]; + char fname[MAXPATHLEN * 2]; snprintf(fname, sizeof(fname), "%s/%s.lua", scriptdir, fs->name); int ret = luaL_loadfile(fs->L, fname);