Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For zero-based arrays, which Ruby has, it looks like the random_index passed to the CSV array can exceed the array's bounds due to the '+1':

    random_index = rand(quotes_array.length + 1)
    @quote_body = quotes_array[random_index]["Quote"]
    @quote_author = quotes_array[random_index]["Author"]
https://github.com/theaisforannie/qotd/blob/master/qotd.rb#L...


Ah, and then it just silently throws an exc and never closes the connection. Nice.

Gracias Señor@!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: