diff options
author | donal.k.fellows@manchester.ac.uk <dkf> | 2005-08-11 12:17:08 (GMT) |
---|---|---|
committer | donal.k.fellows@manchester.ac.uk <dkf> | 2005-08-11 12:17:08 (GMT) |
commit | ac8216fa0f661492628579a86aa9c46627cc9daa (patch) | |
tree | 6628dcb4bda2551aaf3158b37e00d36264d17744 /generic/tkCanvText.c | |
parent | 93e9c0814a911d76b60d8eaf6c0b6dc7c227cad9 (diff) | |
download | tk-ac8216fa0f661492628579a86aa9c46627cc9daa.zip tk-ac8216fa0f661492628579a86aa9c46627cc9daa.tar.gz tk-ac8216fa0f661492628579a86aa9c46627cc9daa.tar.bz2 |
Fix [Bug 1252702]
Diffstat (limited to 'generic/tkCanvText.c')
-rw-r--r-- | generic/tkCanvText.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index 99d8e30..d2c1bf8 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCanvText.c,v 1.15.2.1 2004/06/08 20:44:11 mdejong Exp $ + * RCS: @(#) $Id: tkCanvText.c,v 1.15.2.2 2005/08/11 12:17:09 dkf Exp $ */ #include <stdio.h> @@ -1247,27 +1247,25 @@ GetTextIndex(interp, canvas, itemPtr, obj, indexPtr) * index. */ { TextItem *textPtr = (TextItem *) itemPtr; - size_t length; - int c; + int c, length; TkCanvas *canvasPtr = (TkCanvas *) canvas; Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr; - char *string = Tcl_GetStringFromObj(obj, (int *) &length); + char *string = Tcl_GetStringFromObj(obj, &length); c = string[0]; - length = strlen(string); - if ((c == 'e') && (strncmp(string, "end", length) == 0)) { + if ((c == 'e') && (strncmp(string, "end", (unsigned) length) == 0)) { *indexPtr = textPtr->numChars; - } else if ((c == 'i') && (strncmp(string, "insert", length) == 0)) { + } else if ((c=='i') && (strncmp(string, "insert", (unsigned) length)==0)) { *indexPtr = textPtr->insertPos; - } else if ((c == 's') && (strncmp(string, "sel.first", length) == 0) + } else if ((c=='s') && (strncmp(string, "sel.first", (unsigned) length)==0) && (length >= 5)) { if (textInfoPtr->selItemPtr != itemPtr) { Tcl_SetResult(interp, "selection isn't in item", TCL_STATIC); return TCL_ERROR; } *indexPtr = textInfoPtr->selectFirst; - } else if ((c == 's') && (strncmp(string, "sel.last", length) == 0) + } else if ((c=='s') && (strncmp(string, "sel.last", (unsigned) length)==0) && (length >= 5)) { if (textInfoPtr->selItemPtr != itemPtr) { Tcl_SetResult(interp, "selection isn't in item", TCL_STATIC); |