microsoft / ms-tpm-20-ref

Reference implementation of the TCG Trusted Platform Module 2.0 specification.
Other
343 stars 133 forks source link

Unconditionally run fseek in NvFileSize. #49

Closed Databean closed 4 years ago

Databean commented 4 years ago

The line

assert(fseek(s_NvFile, 0, SEEK_END) == 0);

is not run in NDEBUG mode, due to asserts being removed. However, fseek still has to be run for ftell to properly report the complete file size in NvFileSize. This separates out the fseek call so it works in NDEBUG and DEBUG modes.