increase peb cmdline buffer size

This commit is contained in:
Doug MacEachern 2004-08-03 02:45:26 +00:00
parent df5e418f30
commit b8a09c70f0
3 changed files with 7 additions and 5 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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) {