Skip to content

Commit 055d6b5

Browse files
committed
Fix potential buffer over-read in getTagAsString
If `tag` equals `_countof(SYMBOL_TAG_STRINGS)`, then this function will read one element beyond the boundary of SYMBOL_TAG_STRINGS array.
1 parent 04f7366 commit 055d6b5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Ghidra/Features/PDB/src/pdb/cpp/symbol.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ DWORD getTag(IDiaSymbol& symbol) {
239239

240240
std::wstring getTagAsString(IDiaSymbol& symbol) {
241241
const DWORD tag = getTag(symbol);
242-
if (tag > _countof(SYMBOL_TAG_STRINGS)) {
242+
if (tag > _countof(SYMBOL_TAG_STRINGS) - 1) {
243243
return L"";
244244
}
245245
return SYMBOL_TAG_STRINGS[tag];

0 commit comments

Comments
 (0)