Skip to content

Commit

Permalink
Fix validity checks in ui_ask_singlechoice
Browse files Browse the repository at this point in the history
Check that input is an integer before doing a comparison with it, and
check that it is positive.

Backport of 01a507a.
  • Loading branch information
jmroot committed Feb 16, 2017
1 parent b2ec8c8 commit e214c74
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/port/port.tcl
Expand Up @@ -5480,7 +5480,7 @@ namespace eval portclient::questions {
throw
}
signal -restart error {TERM INT}
if {($input <= [llength $ports] && [string is integer -strict $input])} {
if {[string is integer -strict $input] && $input <= [llength $ports] && $input > 0} {
return [expr {$input - 1}]
} else {
puts "Please enter an index from the above list."
Expand Down

0 comments on commit e214c74

Please sign in to comment.