sanity check strchr results
This commit is contained in:
		
							parent
							
								
									b4a3efc065
								
							
						
					
					
						commit
						efb74c1703
					
				@ -757,9 +757,12 @@ static int proc_stat_read(sigar_t *sigar, sigar_pid_t pid)
 | 
			
		||||
        return status;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ptr = strchr(ptr, '(')+1;
 | 
			
		||||
 | 
			
		||||
    tmp = strrchr(ptr, ')');
 | 
			
		||||
    if (!(ptr = strchr(ptr, '('))) {
 | 
			
		||||
        return EINVAL;
 | 
			
		||||
    }
 | 
			
		||||
    if (!(tmp = strrchr(++ptr, ')'))) {
 | 
			
		||||
        return EINVAL;
 | 
			
		||||
    }
 | 
			
		||||
    len = tmp-ptr;
 | 
			
		||||
 | 
			
		||||
    if (len >= sizeof(pstat->name)) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user