summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-11-08 09:59:28 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-11-08 09:59:28 (GMT)
commit2afe485f41e0c7303cbf8d181745c56f7d19f5b0 (patch)
treedfc5185c7298480c5d4e84bebf3634e8f324d80a /generic
parent008001c3b5e35ff3c122f2eb1bf566d93746b172 (diff)
downloadtcl-2afe485f41e0c7303cbf8d181745c56f7d19f5b0.zip
tcl-2afe485f41e0c7303cbf8d181745c56f7d19f5b0.tar.gz
tcl-2afe485f41e0c7303cbf8d181745c56f7d19f5b0.tar.bz2
NEVER use sizeof(FLEXARRAY)! Use offsetof()
Diffstat (limited to 'generic')
-rw-r--r--generic/tclPkg.c2
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;