diff options
author | kjnash <k.j.nash@usa.net> | 2017-06-13 18:15:46 (GMT) |
---|---|---|
committer | kjnash <k.j.nash@usa.net> | 2017-06-13 18:15:46 (GMT) |
commit | 0d8755e7bb74882ca10bb7cbde4fb4097cb2cc51 (patch) | |
tree | 0783d7c109ac2b5667533b5299d32a80deb45d8c /generic/tkEntry.c | |
parent | d28664f9b1810d40530b09cdcb91eddede0f298d (diff) | |
download | tk-0d8755e7bb74882ca10bb7cbde4fb4097cb2cc51.zip tk-0d8755e7bb74882ca10bb7cbde4fb4097cb2cc51.tar.gz tk-0d8755e7bb74882ca10bb7cbde4fb4097cb2cc51.tar.bz2 |
Test whether in a safe interpreter before writing to the PRIMARY selection. Fixes bug [de156e9efe]. Ready for testing.
Diffstat (limited to 'generic/tkEntry.c')
-rw-r--r-- | generic/tkEntry.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 9e25bed..25774cc 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -887,7 +887,8 @@ EntryWidgetObjCmd( entryPtr->selectLast = index2; } if (!(entryPtr->flags & GOT_SELECTION) - && (entryPtr->exportSelection)) { + && (entryPtr->exportSelection) + && (!Tcl_IsSafe(entryPtr->interp))) { Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, EntryLostSelection, entryPtr); entryPtr->flags |= GOT_SELECTION; @@ -1122,7 +1123,7 @@ ConfigureEntry( * value. */ - oldExport = entryPtr->exportSelection; + oldExport = (entryPtr->exportSelection) && (!Tcl_IsSafe(entryPtr->interp)); if (entryPtr->type == TK_SPINBOX) { oldValues = sbPtr->valueStr; oldFormat = sbPtr->reqFormat; @@ -1276,6 +1277,7 @@ ConfigureEntry( */ if (entryPtr->exportSelection && (!oldExport) + && (!Tcl_IsSafe(entryPtr->interp)) && (entryPtr->selectFirst != -1) && !(entryPtr->flags & GOT_SELECTION)) { Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, EntryLostSelection, @@ -2745,7 +2747,8 @@ EntrySelectTo( * Grab the selection if we don't own it already. */ - if (!(entryPtr->flags & GOT_SELECTION) && (entryPtr->exportSelection)) { + if (!(entryPtr->flags & GOT_SELECTION) && (entryPtr->exportSelection) + && (!Tcl_IsSafe(entryPtr->interp))) { Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, EntryLostSelection, entryPtr); entryPtr->flags |= GOT_SELECTION; @@ -2812,7 +2815,8 @@ EntryFetchSelection( const char *string; const char *selStart, *selEnd; - if ((entryPtr->selectFirst < 0) || !(entryPtr->exportSelection)) { + if ((entryPtr->selectFirst < 0) || (!entryPtr->exportSelection) + || Tcl_IsSafe(entryPtr->interp)) { return -1; } string = entryPtr->displayString; @@ -2865,7 +2869,8 @@ EntryLostSelection( */ if (TkpAlwaysShowSelection(entryPtr->tkwin) - && (entryPtr->selectFirst >= 0) && entryPtr->exportSelection) { + && (entryPtr->selectFirst >= 0) && entryPtr->exportSelection + && (!Tcl_IsSafe(entryPtr->interp))) { entryPtr->selectFirst = -1; entryPtr->selectLast = -1; EventuallyRedraw(entryPtr); @@ -4034,7 +4039,8 @@ SpinboxWidgetObjCmd( entryPtr->selectLast = index2; } if (!(entryPtr->flags & GOT_SELECTION) - && entryPtr->exportSelection) { + && entryPtr->exportSelection + && (!Tcl_IsSafe(entryPtr->interp))) { Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, EntryLostSelection, entryPtr); entryPtr->flags |= GOT_SELECTION; |