diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-11-08 09:59:28 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-11-08 09:59:28 (GMT) |
commit | 2afe485f41e0c7303cbf8d181745c56f7d19f5b0 (patch) | |
tree | dfc5185c7298480c5d4e84bebf3634e8f324d80a /generic/tclPkg.c | |
parent | 008001c3b5e35ff3c122f2eb1bf566d93746b172 (diff) | |
download | tcl-2afe485f41e0c7303cbf8d181745c56f7d19f5b0.zip tcl-2afe485f41e0c7303cbf8d181745c56f7d19f5b0.tar.gz tcl-2afe485f41e0c7303cbf8d181745c56f7d19f5b0.tar.bz2 |
NEVER use sizeof(FLEXARRAY)! Use offsetof()
Diffstat (limited to 'generic/tclPkg.c')
-rw-r--r-- | generic/tclPkg.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/generic/tclPkg.c b/generic/tclPkg.c index bfe1c66..7866158 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -828,7 +828,7 @@ SelectPackage( * Push "ifneeded" package name in "tclPkgFiles" assocdata. */ - pkgName = (PkgName *)ckalloc(sizeof(PkgName) + strlen(name)); + pkgName = (PkgName *)ckalloc(offsetof(PkgName, name) + 1 + strlen(name)); pkgName->nextPtr = pkgFiles->names; strcpy(pkgName->name, name); pkgFiles->names = pkgName; |