diff options
| author | Donald Lee <dlqs@gmx.com> | 2021-07-07 21:53:10 +0800 |
|---|---|---|
| committer | Donald Lee <dlqs@gmx.com> | 2021-07-18 06:32:03 +0800 |
| commit | 24ff8520af692c538f3ff8b3339a307c21a7fa38 (patch) | |
| tree | 2a69b9326588362f11811199eb00352601e0f21a /lib/frrscript.h | |
| parent | 7948c5d27ac5313841a0f8e0b88ecc090932dffe (diff) | |
lib: frrscript_call check name before decode
Signed-off-by: Donald Lee <dlqs@gmx.com>
Diffstat (limited to 'lib/frrscript.h')
| -rw-r--r-- | lib/frrscript.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/frrscript.h b/lib/frrscript.h index 0d5568d342..1e35e2ee41 100644 --- a/lib/frrscript.h +++ b/lib/frrscript.h @@ -123,7 +123,12 @@ void frrscript_init(const char *scriptdir); #define DECODE_ARGS(name, value) \ do { \ lua_getfield(lfs->L, 1, name); \ - DECODE_ARGS_WITH_STATE(lfs->L, value); \ + if (lua_isnil(lfs->L, 2)) { \ + lua_pop(lfs->L, 1); \ + } else { \ + DECODE_ARGS_WITH_STATE(lfs->L, value); \ + } \ + assert(lua_gettop(lfs->L) == 1); \ } while (0) /* |
