diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-08-23 23:01:27 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-08-23 23:01:27 +0200 |
commit | 7c60505e1012a43549c2c075c27463c5399e81ec (patch) | |
tree | 36b176ac078850fc1b5d88445e9bff976fbe7ce4 /src | |
parent | 74c8be2c6803eda3a57991b8867c5c65259b73d6 (diff) |
patch 8.1.0325: strings in swap file may not be NUL terminatedv8.1.0325
Problem: Strings in swap file may not be NUL terminated. (Coverity)
Solution: Limit the length of the used string.
Diffstat (limited to 'src')
-rw-r--r-- | src/memline.c | 11 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/memline.c b/src/memline.c index 3d82af0813..b4e02d7716 100644 --- a/src/memline.c +++ b/src/memline.c @@ -2065,10 +2065,13 @@ get_b0_dict(char_u *fname, dict_T *d) else { /* we have swap information */ - dict_add_string(d, "version", vim_strsave(b0.b0_version)); - dict_add_string(d, "user", vim_strsave(b0.b0_uname)); - dict_add_string(d, "host", vim_strsave(b0.b0_hname)); - dict_add_string(d, "fname", vim_strsave(b0.b0_fname)); + dict_add_string(d, "version", vim_strnsave(b0.b0_version, 10)); + dict_add_string(d, "user", + vim_strnsave(b0.b0_uname, B0_UNAME_SIZE)); + dict_add_string(d, "host", + vim_strnsave(b0.b0_hname, B0_HNAME_SIZE)); + dict_add_string(d, "fname", + vim_strnsave(b0.b0_fname, B0_FNAME_SIZE_ORG)); dict_add_number(d, "pid", char_to_long(b0.b0_pid)); dict_add_number(d, "mtime", char_to_long(b0.b0_mtime)); diff --git a/src/version.c b/src/version.c index bf40df79e9..dfb09653e3 100644 --- a/src/version.c +++ b/src/version.c @@ -795,6 +795,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 325, +/**/ 324, /**/ 323, |