Check for index < 0 too for B_BAD_INDEX. This fixes for example Tracker-Grep
which does
message->GetInfo("field", &type, &count);
while (message->FindBlah("field", --count, &...) == B_OK)
...;
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26695 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1754,7 +1754,7 @@ BMessage::FindData(const char *name, type_code type, int32 index,
|
||||
if (!field)
|
||||
return B_ERROR;
|
||||
|
||||
if (index >= field->count)
|
||||
if (index < 0 || index >= field->count)
|
||||
return B_BAD_INDEX;
|
||||
|
||||
if (field->flags & FIELD_FLAG_FIXED_SIZE) {
|
||||
|
||||
Reference in New Issue
Block a user