[Libva] [PATCH V2 2/2] Use the strncasecmp instead of strcasecmp to make it more robust
Zhao Yakui
yakui.zhao at intel.com
Thu Sep 25 00:19:40 PDT 2014
Signed-off-by: Zhao Yakui <yakui.zhao at intel.com>
---
src/i965_device_info.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/i965_device_info.c b/src/i965_device_info.c
index fa99803..ed90083 100755
--- a/src/i965_device_info.c
+++ b/src/i965_device_info.c
@@ -500,9 +500,14 @@ static void hsw_hw_codec_preinit(VADriverContextP ctx, struct hw_codec_info *cod
found = false;
list_len = sizeof(hsw_cpu_hook_list) / sizeof(char *);
+ model_len = strlen(model_id);
for (i = 0; i < list_len; i++) {
model_ptr = (char *)hsw_cpu_hook_list[i];
- if (strcasecmp(model_id, model_ptr) == 0) {
+
+ if (strlen(model_ptr) != model_len)
+ continue;
+
+ if (strncasecmp(model_id, model_ptr, model_len) == 0) {
found = true;
break;
}
--
1.7.10.1
More information about the Libva
mailing list