From 4512b47be83d708f4dfe6e45a205653635658c23 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Wed, 24 Apr 2013 23:33:13 -0400 Subject: [PATCH] Windows: fail if pSrcParentObject cannot be resolved In AFSSetFileLinkInfo and AFSSetRenameInfo return STATUS_INVALID_PARAMETER if pSrcParentObject cannot be determined. Otherwise, a NULL pointer dereference will occur. Change-Id: I0e265433aa85066005e90b3584f8e865c5be79c8 Reviewed-on: http://gerrit.openafs.org/9807 Reviewed-by: Peter Scott Tested-by: BuildBot Reviewed-by: Jeffrey Altman --- src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp b/src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp index 6892b12b26..d6bf731be1 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp @@ -2300,6 +2300,18 @@ AFSSetFileLinkInfo( IN PIRP Irp) &pSrcFcb->ObjectInformation->ParentFileId); } + if( pSrcParentObject == NULL) + { + + AFSDbgTrace(( AFS_SUBSYSTEM_FILE_PROCESSING, + AFS_TRACE_LEVEL_ERROR, + "AFSSetFileLinkInfo Unable to resolve SrcParentObject (INVALID_PARAMETER)\n")); + + ASSERT( FALSE); + + try_return( ntStatus = STATUS_INVALID_PARAMETER); + } + pFileLinkInfo = (PFILE_LINK_INFORMATION)Irp->AssociatedIrp.SystemBuffer; // @@ -2723,6 +2735,18 @@ AFSSetRenameInfo( IN PIRP Irp) &pSrcFcb->ObjectInformation->ParentFileId); } + if( pSrcParentObject == NULL) + { + + AFSDbgTrace(( AFS_SUBSYSTEM_FILE_PROCESSING, + AFS_TRACE_LEVEL_ERROR, + "AFSSetRenameInfo Unable to resolve SrcParentObject (INVALID_PARAMETER)\n")); + + ASSERT( FALSE); + + try_return( ntStatus = STATUS_INVALID_PARAMETER); + } + // // Perform some basic checks to ensure FS integrity //