buffer truncation looking up MIME types
Per subsequent discussions, switching to BString::SetToFormat which completely eliminates the need for allocating a fixed buffer and will avoid truncation. Change-Id: Ic2a803594877a0a6fb1bc4eba937268351e6f45c Reviewed-on: https://review.haiku-os.org/c/haiku/+/8837 Haiku-Format: Haiku-format Bot <[email protected]> Reviewed-by: Adrien Destugues <[email protected]> Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
36fac427b5
commit
61d47c1e92
@@ -375,9 +375,8 @@ AssociatedTypes::BuildAssociatedTypesTable()
|
|||||||
if (subEntry.GetName(subtype) == B_OK) {
|
if (subEntry.GetName(subtype) == B_OK) {
|
||||||
BPrivate::Storage::to_lower(subtype);
|
BPrivate::Storage::to_lower(subtype);
|
||||||
|
|
||||||
char fulltype[B_PATH_NAME_LENGTH];
|
BString fulltype;
|
||||||
snprintf(fulltype, B_PATH_NAME_LENGTH, "%s/%s",
|
fulltype.SetToFormat("%s/%s", supertype, subtype);
|
||||||
supertype, subtype);
|
|
||||||
|
|
||||||
// Process the subtype
|
// Process the subtype
|
||||||
ProcessType(fulltype);
|
ProcessType(fulltype);
|
||||||
|
|||||||
@@ -373,9 +373,8 @@ SnifferRules::BuildRuleList()
|
|||||||
if (subEntry.GetName(subtype) == B_OK) {
|
if (subEntry.GetName(subtype) == B_OK) {
|
||||||
BPrivate::Storage::to_lower(subtype);
|
BPrivate::Storage::to_lower(subtype);
|
||||||
|
|
||||||
char fulltype[B_PATH_NAME_LENGTH];
|
BString fulltype;
|
||||||
snprintf(fulltype, B_PATH_NAME_LENGTH, "%s/%s",
|
fulltype.SetToFormat("%s/%s", supertype, subtype);
|
||||||
supertype, subtype);
|
|
||||||
|
|
||||||
// Process the subtype
|
// Process the subtype
|
||||||
ProcessType(fulltype, &bytesNeeded);
|
ProcessType(fulltype, &bytesNeeded);
|
||||||
|
|||||||
Reference in New Issue
Block a user