Windows: fail if pSrcParentObject cannot be resolved
authorJeffrey Altman <jaltman@your-file-system.com>
Thu, 25 Apr 2013 03:33:13 +0000 (23:33 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Thu, 25 Apr 2013 17:11:57 +0000 (10:11 -0700)
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 <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp

index 6892b12..d6bf731 100644 (file)
@@ -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
         //