Note: Because of the post following this one, performing this fix is no longer necessary.
I apologize for my first post to start out this way, but I consider this to be of critical importance. To the point that if this fix is not implemented, you should
not run this script.
So, I've discovered a HUGE problem with this script, in version 2.9b.
Reproducing the error is easy.
All one has to do, is type a command like the following:
!weather Canada
Or some other large, vague location with a very large number of towns and cities. As the script is designed to like multiple results, it will proceed to list
each and every single town in Canada (or at least try), if you were to use my previous example.
This greatly increases the likelihood the bot will flood itself off of the network. Sure, users should just use the correct commands in the first place, but mistakes can be made, and as everyone knows, there's always people who, upon discovering exploits, will abuse them.
Fortunately, I discovered a way to fix it. Around line 878 or so, you will see the following lines of code:
Code: Select all
if {[llength [set lr [lsort -unique -increasing $lr]]] == 1} {
unset output
array set output [fetch_html "[lindex $lu 0]" "http://classic.wunderground.com" 1]
} else {
set output(error) "Multiple Results Found: [join $lr "; "]"
}
Change it to the following code:
Code: Select all
if {[llength [set lr [lsort -unique -increasing $lr]]] == 1} {
unset output
array set output [fetch_html "[lindex $lu 0]" "http://classic.wunderground.com" 1]
} else {
#set output(error) "Multiple Results Found: [join $lr "; "]"
if {[llength [set lr [lsort -unique -increasing $lr]]] <= 5} {
set output(error) "Multiple Results Found: [join $lr "; "]"
} else {
set output(error) "More than five results found, please narrow your search!"
}
Note that I changed it return an error if more than five results are found. You can change it to 10, or even 20. However, you must make sure there is an upper limit of some sort.
One you change the code, all you have to do is rehash the bot. To test if you implemented the fix correctly, type
!weather Springfield
on IRC. While it will ordinarily return over five results with a script without my fix, it doesn't produce a huge amount of text.
Unless this fix is implemented, I don't recommend running this otherwise very nice script. Allow me to repeat that:
Do not run this script until this fix is implemented!
Edit: I didn't expect such a quick fix. Thank you.