diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-12-17 15:35:43 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-12-17 15:35:43 +0000 |
commit | b26461715be41653e5982e72c794294702ecded9 (patch) | |
tree | 54abccb0bfdc14c1fa0124b5698a9fc746ea93aa | |
parent | 417e88bb75ee8af1bf696760bba9f114a007f733 (diff) | |
download | vim-git-b26461715be41653e5982e72c794294702ecded9.tar.gz |
patch 9.0.1070: reading beyond array sizev9.0.1070
Problem: Reading beyond array size.
Solution: Only use name[0] and name[1], do not use "name" as a string.
-rw-r--r-- | src/term.c | 12 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/term.c b/src/term.c index b2b14e3d9..7483974ac 100644 --- a/src/term.c +++ b/src/term.c @@ -4389,7 +4389,8 @@ clear_termcodes(void) #define ATC_FROM_TERM 55 /* - * Add a new entry to the list of terminal codes. + * Add a new entry for "name[2]" to the list of terminal codes. + * Note that "name" may not have a terminating NUL. * The list is kept alphabetical for ":set termcap" * "flags" is TRUE when replacing 7-bit by 8-bit controls is desired. * "flags" can also be ATC_FROM_TERM for got_code_from_term(). @@ -4497,7 +4498,8 @@ add_termcode(char_u *name, char_u *string, int flags) { // They are equal but for the ";*": don't add it. #ifdef FEAT_EVAL - ch_log(NULL, "Termcap entry %s did not change", name); + ch_log(NULL, "Termcap entry %c%c did not change", + name[0], name[1]); #endif vim_free(s); return; @@ -4507,8 +4509,8 @@ add_termcode(char_u *name, char_u *string, int flags) { // Replace old code. #ifdef FEAT_EVAL - ch_log(NULL, "Termcap entry %s was: %s", - name, termcodes[i].code); + ch_log(NULL, "Termcap entry %c%c was: %s", + name[0], name[1], termcodes[i].code); #endif vim_free(termcodes[i].code); --tc_len; @@ -4528,7 +4530,7 @@ add_termcode(char_u *name, char_u *string, int flags) } #ifdef FEAT_EVAL - ch_log(NULL, "%s termcap entry %s to %s", action, name, s); + ch_log(NULL, "%s termcap entry %c%c to %s", action, name[0], name[1], s); #endif termcodes[i].name[0] = name[0]; termcodes[i].name[1] = name[1]; diff --git a/src/version.c b/src/version.c index 89d71523a..cd52fed8b 100644 --- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1070, +/**/ 1069, /**/ 1068, |