mirror of
				https://review.coreboot.org/flashrom.git
				synced 2025-10-27 03:12:12 +01:00 
			
		
		
		
	layout.c: Validate _layout_entry_by_name() arguments before use
It may be the case that a layout could not be derived which would result in layout logic being fed a NULL pointer. Validate this case and be defensive to validate the name argument as well. BUG=b:247055486 TEST=builds Change-Id: I2a19c0e586f8575b8b3c2c02b5afad312efacfc9 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/67722 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Felix Singer <felixsinger@posteo.net>
This commit is contained in:
		 Edward O'Callaghan
					Edward O'Callaghan
				
			
				
					committed by
					
						 Edward O'Callaghan
						Edward O'Callaghan
					
				
			
			
				
	
			
			
			 Edward O'Callaghan
						Edward O'Callaghan
					
				
			
						parent
						
							7ed1337309
						
					
				
				
					commit
					be0538f654
				
			
							
								
								
									
										2
									
								
								layout.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								layout.c
									
									
									
									
									
								
							| @@ -58,6 +58,8 @@ static struct romentry *_layout_entry_by_name( | |||||||
| 		const struct flashrom_layout *const layout, const char *name) | 		const struct flashrom_layout *const layout, const char *name) | ||||||
| { | { | ||||||
| 	struct romentry *entry = NULL; | 	struct romentry *entry = NULL; | ||||||
|  | 	if (!layout || !name) | ||||||
|  | 		return NULL; | ||||||
| 	while ((entry = mutable_layout_next(layout, entry))) { | 	while ((entry = mutable_layout_next(layout, entry))) { | ||||||
| 		if (!strcmp(entry->name, name)) | 		if (!strcmp(entry->name, name)) | ||||||
| 			return entry; | 			return entry; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user