LongSoft/Universal-IFR-Extractor

Missing typecast on MinSize and MaxSize

osresearch opened this issue · 0 comments

MinSize and MaxSize are printed as characters, not ints:

0x1A04E4                        String: Local IP Address, 
 VarStoreInfo (VarOffset/VarName): 0x2, 
 VarStore: 0x1, 
 QuestionId: 0x102, 
 MinSize: 0x^G, 
 MaxSize: 0x^O
 {1C 90 08 00 09 00 02 01 01 00 02 00 04 07 0F 00}

Should the types be unsigned or something more specific?

diff --git a/UEFI.cpp b/UEFI.cpp
index 157fa80..30558c0 100644
--- a/UEFI.cpp
+++ b/UEFI.cpp
@@ -441,8 +441,8 @@ void generateUEFIIFRDump(const string &outputFile, const vector<UEFI_IFR_STRING_
 
                 // Display temp
                 fout << "Password: " << strings[temp->Question.Header.Prompt + strPackageOffset] << ", VarStoreInfo (VarOffset/VarName): 0x" << hex << uppercase << temp->Question.VarStoreInfo.VarOffset << ", VarStore: 0x" << temp->Question.VarStoreId << ", QuestionId: 0x" << temp->Question.QuestionId;
-                fout << ", MinSize: 0x" << temp->MinSize;
-                fout << ", MaxSize 0x" << temp->MaxSize;
+                fout << ", MinSize: 0x" << (unsigned) temp->MinSize;
+                fout << ", MaxSize 0x" << (unsigned) temp->MaxSize;
             }
             else if (buffer[j] == EFI_IFR_ONE_OF_OPTION_OP) {
 
@@ -644,7 +644,7 @@ void generateUEFIIFRDump(const string &outputFile, const vector<UEFI_IFR_STRING_
                 EFI_IFR_STRING *temp = (EFI_IFR_STRING*)&buffer[j];
 
                 // Display temp
-                fout << "String: " << strings[temp->Question.Header.Prompt + strPackageOffset] << ", VarStoreInfo (VarOffset/VarName): 0x" << hex << uppercase << temp->Question.VarStoreInfo.VarOffset << ", VarStore: 0x" << temp->Question.VarStoreId << ", QuestionId: 0x" << temp->Question.QuestionId << ", MinSize: 0x" << temp->MinSize << ", MaxSize: 0x" << temp->MaxSize;
+                fout << "String: " << strings[temp->Question.Header.Prompt + strPackageOffset] << ", VarStoreInfo (VarOffset/VarName): 0x" << hex << uppercase << temp->Question.VarStoreInfo.VarOffset << ", VarStore: 0x" << temp->Question.VarStoreId << ", QuestionId: 0x" << temp->Question.QuestionId << ", MinSize: 0x" << (unsigned) temp->MinSize << ", MaxSize: 0x" << (unsigned) temp->MaxSize;
             }
             else if (buffer[j] == EFI_IFR_REFRESH_OP) {