From 10e9f49914cc9e447f8248126c28fa2bf08e9f3a Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 1 Jun 2013 03:58:11 +0200 Subject: [PATCH] QueryParser: Equation::Match(): Fix generic attribute case Init size to the buffer size before passing it to QueryPolicy::NodeGetAttribute(). Since size was 0 by default, we would only read 0 length data. --- headers/private/file_systems/QueryParser.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/headers/private/file_systems/QueryParser.h b/headers/private/file_systems/QueryParser.h index 083e7bea35..b476efbbdf 100644 --- a/headers/private/file_systems/QueryParser.h +++ b/headers/private/file_systems/QueryParser.h @@ -708,6 +708,7 @@ Equation::Match(Entry* entry, Node* node, // get a pointer to the attribute in question union value value; uint8* buffer = (uint8*)&value; + const size_t bufferSize = sizeof(value); // first, check if we are matching for a live query and use that value if (attributeName != NULL && !strcmp(fAttribute, attributeName)) { @@ -737,6 +738,7 @@ Equation::Match(Entry* entry, Node* node, type = B_INT32_TYPE; } else { // then for attributes + size = bufferSize; if (QueryPolicy::NodeGetAttribute(node, fAttribute, buffer, &size, &type) != B_OK) { return MatchEmptyString();