Tcl Source Code

Check-in [65cc894ac5]
Login

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

Overview
Comment:fix off-by-one possible buffer overrun when looking for encodings; found by coverity
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 65cc894ac5c24495a2dcd7ebe0b5c42060f8f280
User & Date: msofer 2015-07-31 22:05:20
References
2017-05-04
12:01
Cherry-pick/backport [65cc894ac5c24495|65cc894ac5]: fix off-by-one possible buffer overrun when look... check-in: 38b35b5cf5 user: jan.nijtmans tags: core-8-5-branch
Context
2015-08-01
19:00
explicitly ignore Tcl_PushCallFrame and TclPushStackFrame return value - it is always TCL_OK. Incons... check-in: 7448dc7ef9 user: msofer tags: trunk
2015-07-31
22:05
fix off-by-one possible buffer overrun when looking for encodings; found by coverity check-in: 65cc894ac5 user: msofer tags: trunk
00:01
fix typo found by Coverity; no effect on "most" platforms (is there anyone where it would matter?) check-in: df57190d7c user: msofer tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to unix/tclUnixInit.c.

598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
static const char *
SearchKnownEncodings(
    const char *encoding)
{
    int left = 0;
    int right = sizeof(localeTable)/sizeof(LocaleTable);

    while (left <= right) {
	int test = (left + right)/2;
	int code = strcmp(localeTable[test].lang, encoding);

	if (code == 0) {
	    return localeTable[test].encoding;
	}
	if (code < 0) {







|







598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
static const char *
SearchKnownEncodings(
    const char *encoding)
{
    int left = 0;
    int right = sizeof(localeTable)/sizeof(LocaleTable);

    while (left < right) {
	int test = (left + right)/2;
	int code = strcmp(localeTable[test].lang, encoding);

	if (code == 0) {
	    return localeTable[test].encoding;
	}
	if (code < 0) {