rapid7/metasploit-framework — pull request #4356 by marcwickenden (2014-12-10 21:44:16+00:00)
Title: Fix issue with execution of perl due to gsub not matching across newlines

When using, for example, the cmd/unix/reverse payload, this exploit was not working because the remote host was returning a value for the perl path that included newlines. Example:
```
/usr/bin/perl
jVUgZjLq
$
```

The gsub was not matching across newlines and therefore the exploit files written to /var/tmp contained

```
/usr/bin/perl

$
```
as the interpreter and failed to run.

The simple fix is to match across newlines with the m modifier. Tested against Ubuntu 8.04 and Exim 4.69.