FileTypes: Prevent a potential snprintf overflow.

This commit is contained in:
Augustin Cavalier 2019-07-12 21:22:28 -04:00
parent fa146526b6
commit 19d1cffe33

View File

@ -104,7 +104,7 @@ name_for_type(BString& string, type_code type, const char* displayAs)
buffer[i] = '.';
}
snprintf(buffer + 6, sizeof(buffer), " (0x%" B_PRIx32 ")", type);
snprintf(buffer + 6, sizeof(buffer) - 6, " (0x%" B_PRIx32 ")", type);
string = buffer;
}