summaryrefslogtreecommitdiff
path: root/lib/frrscript.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2021-01-24 07:52:55 -0500
committerDonald Sharp <sharpd@nvidia.com>2021-01-25 09:15:36 -0500
commit833c1f9fd14c4764b9f36f5e61c57130ff4f7118 (patch)
tree84a4b8b18f24ed6e839853bfc28fb591cdea3552 /lib/frrscript.c
parent8f17f6eb2db11cf8c93c47eda6eafc4981eeab29 (diff)
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 <sharpd@nvidia.com>
Diffstat (limited to 'lib/frrscript.c')
-rw-r--r--lib/frrscript.c2
1 files changed, 1 insertions, 1 deletions
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);