rapid7/metasploit-framework — pull request #2089 by wchen-r7 (2013-07-09 17:56:54+00:00)
Title: Fix potential nil in last_filename

Replacing #2060.

It is possible to get a nil in last_filename if the sub! function doesn't find any 0x00s to replace, so instead
it's best to use sub(), which should at least return the original filename. To make sure we don't hit any other unknown conditions that may result in nil last_filename, it's also convert with to_s to make sure it's always a string.