Skip to content

Commit 7ef1581

Browse files
1640maxcharles-lunarg
authored andcommitted
strncmp length correction
Double quotes in cJSON output were removed at bca23b3 They were also removed from those string literals, however the third `strncmp`'s argument left unchanged, making the function to check beyond the string.
1 parent 287c064 commit 7ef1581

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

loader/loader.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3705,9 +3705,8 @@ VkResult loader_parse_icd_manifest(const struct loader_instance *inst, char *fil
37053705

37063706
char *library_arch_str = loader_cJSON_GetStringValue(loader_cJSON_GetObjectItem(itemICD, "library_arch"));
37073707
if (library_arch_str != NULL) {
3708-
// cJSON includes the quotes by default, so we need to look for those here
3709-
if ((strncmp(library_arch_str, "32", 4) == 0 && sizeof(void *) != 4) ||
3710-
(strncmp(library_arch_str, "64", 4) == 0 && sizeof(void *) != 8)) {
3708+
if ((strncmp(library_arch_str, "32", 2) == 0 && sizeof(void *) != 4) ||
3709+
(strncmp(library_arch_str, "64", 2) == 0 && sizeof(void *) != 8)) {
37113710
loader_log(inst, VULKAN_LOADER_INFO_BIT, 0,
37123711
"loader_parse_icd_manifest: Driver library architecture doesn't match the current running "
37133712
"architecture, skipping this driver");

0 commit comments

Comments
 (0)