# HG changeset patch # User Christian Brabandt # Date 1485095404 -3600 # Node ID 8cff35d5f5dc890f5b9006602524524c38d4f708 # Parent b3aee1f74787f658e9aa7e55d0f533aa98adb9d5 patch 8.0.0213: Netbeans specialKeys command does not check argument length commit https://github.com/vim/vim/commit/ca24e2cfcfd3f064ea1674886e3dcaa8254ad8d7 Author: Bram Moolenaar Date: Sun Jan 22 15:19:22 2017 +0100 patch 8.0.0213: Netbeans specialKeys command does not check argument length Problem: The Netbeans "specialKeys" command does not check if the argument fits in the buffer. (Coverity) Solution: Add a length check. diff --git a/src/netbeans.c b/src/netbeans.c --- a/src/netbeans.c +++ b/src/netbeans.c @@ -2332,7 +2332,8 @@ special_keys(char_u *args) char *save_str = nb_unquote(args, NULL); char *tok = strtok(save_str, " "); char *sep; - char keybuf[64]; +#define KEYBUFLEN 64 + char keybuf[KEYBUFLEN]; char cmdbuf[256]; while (tok != NULL) @@ -2359,10 +2360,13 @@ special_keys(char_u *args) tok++; } - strcpy(&keybuf[i], tok); - vim_snprintf(cmdbuf, sizeof(cmdbuf), - "<%s> :nbkey %s", keybuf, keybuf); - do_map(0, (char_u *)cmdbuf, NORMAL, FALSE); + if (strlen(tok) + i < KEYBUFLEN) + { + strcpy(&keybuf[i], tok); + vim_snprintf(cmdbuf, sizeof(cmdbuf), + "<%s> :nbkey %s", keybuf, keybuf); + do_map(0, (char_u *)cmdbuf, NORMAL, FALSE); + } tok = strtok(NULL, " "); } vim_free(save_str); diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -765,6 +765,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 213, +/**/ 212, /**/ 211,