Tcl Source Code

Check-in [9d68baec02]
Login

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

Overview
Comment:3366265 Buffer allocated one byte too small caused overrun.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-4-branch
Files: files | file ages | folders
SHA1: 9d68baec0208b46cc93dfe5a997bf54fd242e310
User & Date: dgp 2011-07-13 17:53:58
Context
2011-07-15
17:50
Avoid segfaults when RecordByteCodeStats() is called in a deleted interp. check-in: 5313bef77f user: dgp tags: core-8-4-branch
2011-07-13
21:19
merge new test check-in: 38a5642a29 user: dgp tags: core-8-5-branch
17:53
3366265 Buffer allocated one byte too small caused overrun. check-in: 9d68baec02 user: dgp tags: core-8-4-branch
2011-07-12
15:08
platform portable type matching in debug prints. check-in: 27b5f75270 user: dgp tags: core-8-4-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.








1
2
3
4
5
6
7







2011-07-03  Donal K. Fellows  <[email protected]>

	* doc/FileSystem.3: Corrected statements about ctime field of 'struct
	stat'; that was always the time of the last metadata change, not the
	time of creation.

2011-06-22  Andreas Kupries  <[email protected]>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
2011-07-13  Don Porter  <[email protected]>

	* generic/tclProc.c:	[Bug 3366265] Buffer for storing the command
	* tests/indexObj.test:	name formatted as a list element is allocated
	* tests/proc.test:	one byte too small, causing buffer overflow
	when the proc with the empty name raises a "wrong num args" error.

2011-07-03  Donal K. Fellows  <[email protected]>

	* doc/FileSystem.3: Corrected statements about ctime field of 'struct
	stat'; that was always the time of the last metadata change, not the
	time of creation.

2011-06-22  Andreas Kupries  <[email protected]>

Changes to generic/tclProc.c.

1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165

	/*
	 * Quote the proc name if it contains spaces (Bug 942757).
	 */

	len = Tcl_ScanCountedElement(procName, nameLen, &flags);
	if (len != nameLen) {
	    char *procName1 = ckalloc((unsigned) len);
	    len = Tcl_ConvertCountedElement(procName, nameLen, procName1, flags);
	    Tcl_AppendToObj(objResult, procName1, len);
	    ckfree(procName1);
	} else {
	    Tcl_AppendToObj(objResult, procName, len);
	}








|







1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165

	/*
	 * Quote the proc name if it contains spaces (Bug 942757).
	 */

	len = Tcl_ScanCountedElement(procName, nameLen, &flags);
	if (len != nameLen) {
	    char *procName1 = ckalloc((unsigned) len + 1);
	    len = Tcl_ConvertCountedElement(procName, nameLen, procName1, flags);
	    Tcl_AppendToObj(objResult, procName1, len);
	    ckfree(procName1);
	} else {
	    Tcl_AppendToObj(objResult, procName, len);
	}

Changes to tests/indexObj.test.

104
105
106
107
108
109
110





111
112
113
114
115
116
117
} "wrong # args: should be \"\""
test indexObj-5.5 {Tcl_WrongNumArgs} {
    testwrongnumargs 1 "" mycmd foo
} "wrong # args: should be \"mycmd\""
test indexObj-5.6 {Tcl_WrongNumArgs} {
    testwrongnumargs 2 "" mycmd foo
} "wrong # args: should be \"mycmd foo\""






test indexObj-6.1 {Tcl_GetIndexFromObjStruct} {
    set x a
    testgetindexfromobjstruct $x 0
} "wrong # args: should be \"testgetindexfromobjstruct a 0\""
test indexObj-6.2 {Tcl_GetIndexFromObjStruct} {
    set x a







>
>
>
>
>







104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
} "wrong # args: should be \"\""
test indexObj-5.5 {Tcl_WrongNumArgs} {
    testwrongnumargs 1 "" mycmd foo
} "wrong # args: should be \"mycmd\""
test indexObj-5.6 {Tcl_WrongNumArgs} {
    testwrongnumargs 2 "" mycmd foo
} "wrong # args: should be \"mycmd foo\""
# Contrast this with test proc-3.6; they have to be like this because
# of [Bug 1066837] so Itcl won't break.
test indexObj-5.7 {Tcl_WrongNumArgs} testindexobj {
    testwrongnumargs 2 "fee fi" "fo fum" foo bar
} "wrong # args: should be \"fo fum foo fee fi\""

test indexObj-6.1 {Tcl_GetIndexFromObjStruct} {
    set x a
    testgetindexfromobjstruct $x 0
} "wrong # args: should be \"testgetindexfromobjstruct a 0\""
test indexObj-6.2 {Tcl_GetIndexFromObjStruct} {
    set x a

Changes to tests/proc.test.

166
167
168
169
170
171
172





173
174
175
176
177
178
179
    list [catch {p} msg] $msg
} {1 {wrong # args: should be "p x"}}

test proc-3.6 {TclObjInterpProc, proper quoting of proc name, Bug 942757} {
    proc {a b  c} {x} {info commands 3m}
    list [catch {{a b  c}} msg] $msg
} {1 {wrong # args: should be "{a b  c} x"}}






catch {eval namespace delete [namespace children :: test_ns_*]}
catch {rename p ""}
catch {rename {} ""}
catch {rename {a b  c} {}}
catch {unset msg}








>
>
>
>
>







166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
    list [catch {p} msg] $msg
} {1 {wrong # args: should be "p x"}}

test proc-3.6 {TclObjInterpProc, proper quoting of proc name, Bug 942757} {
    proc {a b  c} {x} {info commands 3m}
    list [catch {{a b  c}} msg] $msg
} {1 {wrong # args: should be "{a b  c} x"}}

test proc-3.7 {TclObjInterpProc, wrong num args, Bug 3366265} {
    proc {} {x} {}
    list [catch {{}} msg] $msg
} {1 {wrong # args: should be "{} x"}}

catch {eval namespace delete [namespace children :: test_ns_*]}
catch {rename p ""}
catch {rename {} ""}
catch {rename {a b  c} {}}
catch {unset msg}