From 78b2b58ab1117d89d7fe41d14e370a17e8fc0c9e Mon Sep 17 00:00:00 2001 From: Veli-Matti Visuri Date: Mon, 4 Dec 2017 21:20:05 +0200 Subject: [PATCH] Fix varargs leaks --- c/meterpreter/source/common/common.h | 1 + c/meterpreter/source/elevator/elevator.h | 1 + c/meterpreter/source/screenshot/screenshot.h | 1 + 3 files changed, 3 insertions(+) diff --git a/c/meterpreter/source/common/common.h b/c/meterpreter/source/common/common.h index bbd6acc9..ae780df7 100755 --- a/c/meterpreter/source/common/common.h +++ b/c/meterpreter/source/common/common.h @@ -104,6 +104,7 @@ static _inline void real_dprintf(char *format, ...) vsnprintf_s(buffer + len, sizeof(buffer)-len, sizeof(buffer)-len - 3, format, args); strcat_s(buffer, sizeof(buffer), "\r\n"); OutputDebugStringA(buffer); + va_end(args); } #endif diff --git a/c/meterpreter/source/elevator/elevator.h b/c/meterpreter/source/elevator/elevator.h index cd37bcf6..2209beb7 100644 --- a/c/meterpreter/source/elevator/elevator.h +++ b/c/meterpreter/source/elevator/elevator.h @@ -21,6 +21,7 @@ static _inline void real_dprintf(char *format, ...) { vsnprintf_s(buffer, sizeof(buffer), sizeof(buffer)-3, format,args); strcat_s(buffer, sizeof(buffer), "\r\n"); OutputDebugString(buffer); + va_end(args); } // Simple macro to close a handle and set the handle to NULL. diff --git a/c/meterpreter/source/screenshot/screenshot.h b/c/meterpreter/source/screenshot/screenshot.h index 99b9a675..9ad1a3df 100644 --- a/c/meterpreter/source/screenshot/screenshot.h +++ b/c/meterpreter/source/screenshot/screenshot.h @@ -21,6 +21,7 @@ static _inline void real_dprintf(char *format, ...) { vsnprintf_s(buffer, sizeof(buffer), sizeof(buffer)-3, format,args); strcat_s(buffer, sizeof(buffer), "\r\n"); OutputDebugStringA(buffer); + va_end(args); } // Simple macro to close a handle and set the handle to NULL.