Tcl Source Code

Check-in [0b332ef62e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:3559678 Fix bad filename normalization when the last component is the empty string.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-5-branch
Files: files | file ages | folders
SHA1: 0b332ef62e03225325062a8361ba4003775d7581
User & Date: dgp 2012-08-20 23:45:25
Context
2012-08-23
12:07
[Bug 3496014] Protect Tcl_SetByteArrayObj for invalid values (Backported from Tcl 8.6) check-in: 268122a79b user: jan.nijtmans tags: core-8-5-branch
2012-08-20
23:50
3559678 Fix bad filename normalization when the last component is the empty string. check-in: ec32e3cc76 user: dgp tags: trunk
23:45
3559678 Fix bad filename normalization when the last component is the empty string. check-in: 0b332ef62e user: dgp tags: core-8-5-branch
09:01
... and don't forget ChangeLog entry check-in: 4000282abb user: jan.nijtmans tags: core-8-5-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.






1
2
3
4
5
6
7





2012-08-20  Jan Nijtmans  <[email protected]>

	* win/tclWinPort.h:  Remove wrapper macro for ntohs(): unnecessary,
	because it doesn't require an initialized winsock_2 library. See:
	<http://msdn.microsoft.com/en-us/library/windows/desktop/ms740075%28v=vs.85%29.aspx>
	* win/tclWinSock.c
	* generic/tclStubInit.c
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
2012-08-20  Don Porter  <[email protected]>

	* generic/tclPathObj.c:	[Bug 3559678] Fix bad filename normalization
	when the last component is the empty string.

2012-08-20  Jan Nijtmans  <[email protected]>

	* win/tclWinPort.h:  Remove wrapper macro for ntohs(): unnecessary,
	because it doesn't require an initialized winsock_2 library. See:
	<http://msdn.microsoft.com/en-us/library/windows/desktop/ms740075%28v=vs.85%29.aspx>
	* win/tclWinSock.c
	* generic/tclStubInit.c

Changes to generic/tclPathObj.c.

1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845


1846



1847
1848
1849
1850
1851
1852
1853
    if (PATHFLAGS(pathPtr) != 0) {
	/*
	 * This is a special path object which is the result of something like
	 * 'file join'
	 */

	Tcl_Obj *dir, *copy;
	int cwdLen, pathType;

	pathType = Tcl_FSGetPathType(fsPathPtr->cwdPtr);
	dir = Tcl_FSGetNormalizedPath(interp, fsPathPtr->cwdPtr);
	if (dir == NULL) {
	    return NULL;
	}
	/* TODO: Figure out why this is needed. */
	if (pathPtr->bytes == NULL) {
	    UpdateStringOfFsPath(pathPtr);
	}



	copy = AppendPath(dir, fsPathPtr->normPathPtr);



	Tcl_IncrRefCount(dir);
	Tcl_IncrRefCount(copy);

	/*
	 * We now own a reference on both 'dir' and 'copy'
	 */








|











>
>
|
>
>
>







1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
    if (PATHFLAGS(pathPtr) != 0) {
	/*
	 * This is a special path object which is the result of something like
	 * 'file join'
	 */

	Tcl_Obj *dir, *copy;
	int tailLen, cwdLen, pathType;

	pathType = Tcl_FSGetPathType(fsPathPtr->cwdPtr);
	dir = Tcl_FSGetNormalizedPath(interp, fsPathPtr->cwdPtr);
	if (dir == NULL) {
	    return NULL;
	}
	/* TODO: Figure out why this is needed. */
	if (pathPtr->bytes == NULL) {
	    UpdateStringOfFsPath(pathPtr);
	}

	Tcl_GetStringFromObj(fsPathPtr->normPathPtr, &tailLen);
	if (tailLen) {
	    copy = AppendPath(dir, fsPathPtr->normPathPtr);
	} else {
	    copy = Tcl_DuplicateObj(dir);
	}
	Tcl_IncrRefCount(dir);
	Tcl_IncrRefCount(copy);

	/*
	 * We now own a reference on both 'dir' and 'copy'
	 */