1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-10-29 18:07:27 +01:00

Fix crash with long exe name in process list

Instead of invoking the Watson crashamajigger when the process
associated with a connection has a long executable name, truncate to the
length available in the buffer.

[See #609]
This commit is contained in:
James Lee 2012-08-28 16:57:24 -05:00
parent bcfaf577ec
commit dd9ef0c7e5

View File

@ -58,7 +58,7 @@ DWORD set_process_name(DWORD pid, char * buffer, DWORD buffer_size)
if(p32f(hSnapshot,&pe32)) {
do {
if (pe32.th32ProcessID == pid) {
sprintf_s(buffer, buffer_size, "%d/%s",pid, pe32.szExeFile);
_snprintf_s(buffer, buffer_size-1, _TRUNCATE, "%d/%s",pid, pe32.szExeFile);
break;
}
} while(p32n(hSnapshot,&pe32));