diff --git a/src/winpmem/winpmem.cpp b/src/winpmem/winpmem.cpp index a034b6e1..90729315 100644 --- a/src/winpmem/winpmem.cpp +++ b/src/winpmem/winpmem.cpp @@ -64,8 +64,8 @@ int WinPmem::toggle_write_mode() { WinPmem::WinPmem(): suppress_output(FALSE), fd_(INVALID_HANDLE_VALUE), - out_fd_(INVALID_HANDLE_VALUE), - service_name(PMEM_SERVICE_NAME) { + out_fd_(INVALID_HANDLE_VALUE) { + _tcscpy_s(service_name, PMEM_SERVICE_NAME); _tcscpy_s(last_error, TEXT("")); max_physical_memory_ = 0; } diff --git a/src/winpmem/winpmem.h b/src/winpmem/winpmem.h index d8335401..8f02b52c 100644 --- a/src/winpmem/winpmem.h +++ b/src/winpmem/winpmem.h @@ -81,7 +81,9 @@ class WinPmem { // The file handle to the image file. HANDLE out_fd_; - TCHAR *service_name; + + // 256: The maximum length of Windows service name string. + TCHAR service_name[256]; TCHAR driver_filename[MAX_PATH]; // This is the maximum size of memory calculated.