From b8a09c70f0e61eea613aaebae4c40368b8e8b554 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Tue, 3 Aug 2004 02:45:26 +0000 Subject: [PATCH] increase peb cmdline buffer size --- src/os/win32/peb.c | 8 ++++---- src/os/win32/sigar_os.h | 2 ++ src/os/win32/win32_sigar.c | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/os/win32/peb.c b/src/os/win32/peb.c index 330dcfab..06771125 100644 --- a/src/os/win32/peb.c +++ b/src/os/win32/peb.c @@ -84,7 +84,7 @@ int sigar_proc_cmdline_get(sigar_t *sigar, HANDLE proc, char *cmdline) int status; LPBYTE scratch; DWORD base; - WCHAR buf[MAX_PATH]; + WCHAR buf[SIGAR_CMDLINE_MAX]; if ((status = sigar_peb_get(sigar, proc, &base)) != SIGAR_OK) { return status; @@ -96,10 +96,10 @@ int sigar_proc_cmdline_get(sigar_t *sigar, HANDLE proc, char *cmdline) PEB_NEXT(scratch); //skip exe name - wcsncpy(buf, (LPWSTR)scratch, MAX_PATH); - buf[MAX_PATH-1] = L'\0'; + wcsncpy(buf, (LPWSTR)scratch, SIGAR_CMDLINE_MAX); + buf[SIGAR_CMDLINE_MAX-1] = L'\0'; - SIGAR_W2A(buf, cmdline, MAX_PATH); + SIGAR_W2A(buf, cmdline, SIGAR_CMDLINE_MAX); return SIGAR_OK; } diff --git a/src/os/win32/sigar_os.h b/src/os/win32/sigar_os.h index 71364649..19c19f6f 100644 --- a/src/os/win32/sigar_os.h +++ b/src/os/win32/sigar_os.h @@ -19,6 +19,8 @@ /* see apr/include/arch/win32/atime.h */ #define EPOCH_DELTA INT64_C(11644473600000000) +#define SIGAR_CMDLINE_MAX (MAX_PATH * 3) + static __inline sigar_uint64_t FileTimeToTime(FILETIME *ft) { sigar_uint64_t time; diff --git a/src/os/win32/win32_sigar.c b/src/os/win32/win32_sigar.c index f38db319..44742599 100644 --- a/src/os/win32/win32_sigar.c +++ b/src/os/win32/win32_sigar.c @@ -919,7 +919,7 @@ static int sigar_remote_proc_args_get(sigar_t *sigar, sigar_pid_t pid, sigar_proc_args_t *procargs) { int status; - char cmdline[MAX_PATH], *ptr = cmdline, *arg; + char cmdline[SIGAR_CMDLINE_MAX], *ptr = cmdline, *arg; HANDLE proc = open_process(pid); if (!proc) {