mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	string: on strstrip(), first remove leading spaces before running over str
... so that strlen() iterates over a smaller string comprising of the remaining characters only. Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
		
							parent
							
								
									f653398c86
								
							
						
					
					
						commit
						84c95c9acf
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -364,8 +364,8 @@ char *strstrip(char *s)
 | 
			
		|||
	size_t size;
 | 
			
		||||
	char *end;
 | 
			
		||||
 | 
			
		||||
	s = skip_spaces(s);
 | 
			
		||||
	size = strlen(s);
 | 
			
		||||
 | 
			
		||||
	if (!size)
 | 
			
		||||
		return s;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -374,7 +374,7 @@ char *strstrip(char *s)
 | 
			
		|||
		end--;
 | 
			
		||||
	*(end + 1) = '\0';
 | 
			
		||||
 | 
			
		||||
	return skip_spaces(s);
 | 
			
		||||
	return s;
 | 
			
		||||
}
 | 
			
		||||
EXPORT_SYMBOL(strstrip);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue