mirror of
https://github.com/stefanberger/libtpms
synced 2026-08-12 21:35:50 +00:00
tpm2: Fix coverity scan errors in NvFileSize
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
parent
cbc70e79d5
commit
1b2c4fc5b9
@ -135,18 +135,25 @@ NvFileSize(
|
||||
)
|
||||
{
|
||||
long fileSize;
|
||||
long filePos = ftell(s_NvFile);
|
||||
long filePos;
|
||||
//
|
||||
|
||||
assert(NULL != s_NvFile);
|
||||
|
||||
|
||||
filePos = ftell(s_NvFile); // libtpms changed begin
|
||||
if (filePos < 0)
|
||||
return -1; // libtpms changed end
|
||||
|
||||
fseek(s_NvFile, 0, SEEK_END);
|
||||
fileSize = ftell(s_NvFile);
|
||||
switch(leaveAt)
|
||||
{
|
||||
case SEEK_SET:
|
||||
filePos = 0;
|
||||
/* fall through */
|
||||
case SEEK_CUR:
|
||||
fseek(s_NvFile, filePos, SEEK_SET);
|
||||
if (fseek(s_NvFile, filePos, SEEK_SET) < 0) // libtpms changed
|
||||
return -1; // libtpms changed
|
||||
break;
|
||||
case SEEK_END:
|
||||
break;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user