rapid7/metasploit-framework — pull request #2152 by Meatballs1 (2013-07-24 18:14:37+00:00)
Title: [FixRM:7923] x64 DLL payload Corruption

http://dev.metasploit.com/redmine/issues/7923

dll template.h specifies 2048
exe is set to 4096
exe service is 8192

I don't think this has been noticed in x86 dlls because I don't think they have been recompiled since the template.h size was reduced.

I have taken the lead from exe-only to put an if statement to check if the payload is oversized for the buffer.