summaryrefslogtreecommitdiffstats
path: root/generic/tclZipfs.c
diff options
context:
space:
mode:
authorapnadkarni <apnmbx-wits@yahoo.com>2023-09-13 16:45:19 (GMT)
committerapnadkarni <apnmbx-wits@yahoo.com>2023-09-13 16:45:19 (GMT)
commite28353f4c36473ce17523409cca53c6d3dfc2612 (patch)
tree94f025b64e723a237247cad5d421d93ef404af3a /generic/tclZipfs.c
parente3d4f2f6e78f0eb58e935714792d059be9f6e84d (diff)
downloadtcl-e28353f4c36473ce17523409cca53c6d3dfc2612.zip
tcl-e28353f4c36473ce17523409cca53c6d3dfc2612.tar.gz
tcl-e28353f4c36473ce17523409cca53c6d3dfc2612.tar.bz2
Bug [01d8f30342]. zipfs canonical produces garbage.
Diffstat (limited to 'generic/tclZipfs.c')
-rw-r--r--generic/tclZipfs.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c
index 4d86b8c..40ee564 100644
--- a/generic/tclZipfs.c
+++ b/generic/tclZipfs.c
@@ -910,10 +910,12 @@ CanonicalPath(
break;
default:
if (inZipfs) {
- Tcl_DStringSetLength(dsPtr, i + j + ZIPFS_VOLUME_LEN);
+ Tcl_DStringSetLength(dsPtr, i + 1 + j + ZIPFS_VOLUME_LEN);
path = Tcl_DStringValue(dsPtr);
memcpy(path, ZIPFS_VOLUME, ZIPFS_VOLUME_LEN);
- memcpy(path + ZIPFS_VOLUME_LEN + i , tail, j);
+ memcpy(path+ZIPFS_VOLUME_LEN, root, i);
+ path[ZIPFS_VOLUME_LEN+i] = '/';
+ memcpy(path + ZIPFS_VOLUME_LEN + 1 + i, tail, j);
} else {
Tcl_DStringSetLength(dsPtr, i + j + 1);
path = Tcl_DStringValue(dsPtr);