amdfwtool: Check sanity before filling the data array
Change-Id: I8284c35a0124ba4588d199024e28d3445c681896 Signed-off-by: Zheng Bao <fishbaozi@gmail.com>wq Reviewed-on: https://review.coreboot.org/c/coreboot/+/78763 Reviewed-by: Martin L Roth <gaumless@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
		| @@ -618,10 +618,15 @@ static int is_valid_entry(char *oneline, regmatch_t match[N_MATCHES]) | |||||||
| 		   match[4]: Optional directory level to be dropped | 		   match[4]: Optional directory level to be dropped | ||||||
| 		   match[6]: Optional hash table ID to put the hash for the entry | 		   match[6]: Optional hash table ID to put the hash for the entry | ||||||
| 		 */ | 		 */ | ||||||
|  | 		if (match[FW_TYPE].rm_eo != -1) | ||||||
| 			oneline[match[FW_TYPE].rm_eo] = '\0'; | 			oneline[match[FW_TYPE].rm_eo] = '\0'; | ||||||
|  | 		if (match[FW_FILE].rm_eo != -1) | ||||||
| 			oneline[match[FW_FILE].rm_eo] = '\0'; | 			oneline[match[FW_FILE].rm_eo] = '\0'; | ||||||
|  | 		if (match[OPT_LEVEL].rm_eo != -1) | ||||||
| 			oneline[match[OPT_LEVEL].rm_eo] = '\0'; | 			oneline[match[OPT_LEVEL].rm_eo] = '\0'; | ||||||
|  | 		if (match[OPT_HASH_TABLE_ID].rm_eo != -1) | ||||||
| 			oneline[match[OPT_HASH_TABLE_ID].rm_eo] = '\0'; | 			oneline[match[OPT_HASH_TABLE_ID].rm_eo] = '\0'; | ||||||
|  | 		if (match[OPT_FWID_TYPE].rm_eo != -1) | ||||||
| 			oneline[match[OPT_FWID_TYPE].rm_eo] = '\0'; | 			oneline[match[OPT_FWID_TYPE].rm_eo] = '\0'; | ||||||
| 		retval = 1; | 		retval = 1; | ||||||
| 	} else { | 	} else { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user