mirror of
				https://review.coreboot.org/flashrom.git
				synced 2025-11-04 07:00:39 +01:00 
			
		
		
		
	Fix handling of empty dmidecode output
Corresponding to flashrom svn r973. Signed-off-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
This commit is contained in:
		
							
								
								
									
										7
									
								
								dmi.c
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								dmi.c
									
									
									
									
									
								
							@@ -56,11 +56,14 @@ static char *get_dmi_string(const char *string_name)
 | 
			
		||||
		printf_debug("DMI pipe open error\n");
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
	if (!fgets(answerbuf, DMI_MAX_ANSWER_LEN, dmidecode_pipe) &&
 | 
			
		||||
	    ferror(dmidecode_pipe)) {
 | 
			
		||||
	if (!fgets(answerbuf, DMI_MAX_ANSWER_LEN, dmidecode_pipe)) {
 | 
			
		||||
		if(ferror(dmidecode_pipe)) {
 | 
			
		||||
			printf_debug("DMI pipe read error\n");
 | 
			
		||||
			pclose(dmidecode_pipe);
 | 
			
		||||
			return NULL;
 | 
			
		||||
		} else {
 | 
			
		||||
			answerbuf[0] = 0;	/* Hit EOF */
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	/* Toss all output above DMI_MAX_ANSWER_LEN away to prevent
 | 
			
		||||
	   deadlock on pclose. */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user