diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-08-08 20:49:14 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-08-08 20:49:14 +0200 |
commit | 47ed553fd5bebfc36eb8aa81686eeaa5a84eccac (patch) | |
tree | 73dbe93fe15754af8a4384ef66d7f595c9bbb8a6 /src/textprop.c | |
parent | 8c5a278fc508da6dfe50e69b6ee734451aa4eafb (diff) | |
download | vim-git-47ed553fd5bebfc36eb8aa81686eeaa5a84eccac.tar.gz |
patch 8.1.1827: allocating more memory than needed for extended structsv8.1.1827
Problem: Allocating more memory than needed for extended structs.
Solution: Use offsetof() instead of sizeof(). (Dominique Pelle,
closes #4786)
Diffstat (limited to 'src/textprop.c')
-rw-r--r-- | src/textprop.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/textprop.c b/src/textprop.c index f219b925f..a97641429 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -695,7 +695,7 @@ prop_type_set(typval_T *argvars, int add) semsg(_("E969: Property type %s already defined"), name); return; } - prop = alloc_clear(sizeof(proptype_T) + STRLEN(name)); + prop = alloc_clear(offsetof(proptype_T, pt_name) + STRLEN(name) + 1); if (prop == NULL) return; STRCPY(prop->pt_name, name); |