Fixed path NULL checks.

This commit is contained in:
Armin Novak 2019-11-19 10:48:25 +01:00
parent 4c5bfcc235
commit f9b3f270fe
2 changed files with 4 additions and 5 deletions

View File

@ -94,7 +94,7 @@ static WCHAR* drive_file_combine_fullpath(const WCHAR* base_path, const WCHAR* p
WCHAR* fullpath;
size_t base_path_length;
if (!base_path || !path)
if (!base_path || (!path && (PathLength > 0)))
return NULL;
base_path_length = _wcslen(base_path) * 2;
@ -338,7 +338,7 @@ DRIVE_FILE* drive_file_new(const WCHAR* base_path, const WCHAR* path, UINT32 Pat
{
DRIVE_FILE* file;
if (!base_path || !path)
if (!base_path || (!path && (PathLength > 0)))
return NULL;
file = (DRIVE_FILE*)calloc(1, sizeof(DRIVE_FILE));

View File

@ -163,7 +163,7 @@ static UINT drive_process_irp_create(DRIVE_DEVICE* drive, IRP* irp)
UINT32 CreateOptions;
UINT32 PathLength;
UINT64 allocationSize;
const WCHAR* path = NULL;
const WCHAR* path;
if (!drive || !irp || !irp->devman || !irp->Complete)
return ERROR_INVALID_PARAMETER;
@ -182,7 +182,6 @@ static UINT drive_process_irp_create(DRIVE_DEVICE* drive, IRP* irp)
if (Stream_GetRemainingLength(irp->input) < PathLength)
return ERROR_INVALID_DATA;
if (PathLength > 0)
path = (const WCHAR*)Stream_Pointer(irp->input);
FileId = irp->devman->id_sequence++;
file = drive_file_new(drive->path, path, PathLength, FileId, DesiredAccess, CreateDisposition,