summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2014-10-31 11:14:24 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2014-10-31 11:14:24 (GMT)
commita4303c31209825c3819a237502f646868c4bc37d (patch)
tree3026ea2a2b43d4f596fb58f6022b4a6b77c0992f
parent2d1631b0f035c1c171f4876d584af1fe60ca676c (diff)
parent384950b6d12f0e3d0da23ed08707b41eb609c9cd (diff)
downloadtcl-a4303c31209825c3819a237502f646868c4bc37d.zip
tcl-a4303c31209825c3819a237502f646868c4bc37d.tar.gz
tcl-a4303c31209825c3819a237502f646868c4bc37d.tar.bz2
Extend WinIsReserved() to recognize COM[5-9]: as valid com ports as well. Prevent possible buffer-overflow if COM name ends with ':'.
-rw-r--r--win/tclWinFile.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 844eb9e..4cd042a 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -1241,9 +1241,9 @@ WinIsReserved(
if ((path[0] == 'c' || path[0] == 'C')
&& (path[1] == 'o' || path[1] == 'O')) {
if ((path[2] == 'm' || path[2] == 'M')
- && path[3] >= '1' && path[3] <= '4') {
+ && path[3] >= '1' && path[3] <= '9') {
/*
- * May have match for 'com[1-4]:?', which is a serial port.
+ * May have match for 'com[1-9]:?', which is a serial port.
*/
if (path[4] == '\0') {
@@ -2948,7 +2948,7 @@ TclNativeCreateNativeRep(
if (nativePathPtr==0) {
return 0;
}
- MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str, -1, nativePathPtr, len);
+ MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str, -1, nativePathPtr, len+1);
/*
** If path starts with "//?/" or "\\?\" (extended path), translate
** any slashes to backslashes but leave the '?' intact