Skip to content

Commit

Permalink
Add check for the input file whose size is Zero.
Browse files Browse the repository at this point in the history
git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1306 7335b38e-4728-0410-8992-fb3ffe349368
  • Loading branch information
lgao4 committed Aug 21, 2008
1 parent 9d0156a commit 4d3a0c1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Source/C/GenSec/GenSec.c
Expand Up @@ -684,9 +684,15 @@ Routine Description:
if (FileBuffer != NULL) {
free (FileBuffer);
}
Error (NULL, 0, 0001, "Error opening file for reading", InputFileName[0]);
return Status;
}

if (InputLength == 0) {
Error (NULL, 0, 2000, "Invalid parameter", "the size of input file %s can't be zero", InputFileName);
return EFI_NOT_FOUND;
}

//
// Now data is in FileBuffer + Offset
//
Expand Down Expand Up @@ -1260,6 +1266,7 @@ Routine Description:
}

if (Status != EFI_SUCCESS || OutFileBuffer == NULL) {
Error (NULL, 0, 2000, "Status is not successful", "Status value is 0x%X", (UINTN) Status);
goto Finish;
}

Expand Down

0 comments on commit 4d3a0c1

Please sign in to comment.