diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-08-29 13:39:17 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-08-29 13:39:17 +0200 |
commit | e3d4685f1f716e0c516332101d85e0930f20fc59 (patch) | |
tree | 60b4b08d87d23ceb87227df3bedf8aa16305f21c /src/evalvars.c | |
parent | 423a85a11a9d3d658906aea715fed7fe6aa83cd8 (diff) |
patch 8.2.1539: using invalid script ID causes a crashv8.2.1539
Problem: Using invalid script ID causes a crash.
Solution: Check the script ID to be valid. (closes #6804)
Diffstat (limited to 'src/evalvars.c')
-rw-r--r-- | src/evalvars.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/evalvars.c b/src/evalvars.c index a946c75ba7..ecd0ce6bd5 100644 --- a/src/evalvars.c +++ b/src/evalvars.c @@ -524,7 +524,7 @@ list_vim_vars(int *first) static void list_script_vars(int *first) { - if (current_sctx.sc_sid > 0 && current_sctx.sc_sid <= script_items.ga_len) + if (SCRIPT_ID_VALID(current_sctx.sc_sid)) list_hashtable_vars(&SCRIPT_VARS(current_sctx.sc_sid), "s:", FALSE, first); } @@ -2609,7 +2609,7 @@ get_script_local_ht(void) { scid_T sid = current_sctx.sc_sid; - if (sid > 0 && sid <= script_items.ga_len) + if (SCRIPT_ID_VALID(sid)) return &SCRIPT_VARS(sid); return NULL; } |