cygwin: fix potential buffer overflow in fork
When fork fails, we can use "%s" now with system_sprintf for the errmsg rather than a (potentially too small) buffer for the format string. * fork.cc (fork): Use "%s" with system_printf now.
This commit is contained in:
		
				
					committed by
					
						 Corinna Vinschen
						Corinna Vinschen
					
				
			
			
				
	
			
			
			
						parent
						
							4449971295
						
					
				
				
					commit
					1adbd77cab
				
			| @@ -618,13 +618,8 @@ fork () | ||||
|       if (!grouped.errmsg) | ||||
| 	syscall_printf ("fork failed - child pid %d, errno %d", grouped.child_pid, grouped.this_errno); | ||||
|       else | ||||
| 	{ | ||||
| 	  char buf[strlen (grouped.errmsg) + sizeof ("child %d - , errno 4294967295  ")]; | ||||
| 	  strcpy (buf, "child %d - "); | ||||
| 	  strcat (buf, grouped.errmsg); | ||||
| 	  strcat (buf, ", errno %d"); | ||||
| 	  system_printf (buf, grouped.child_pid, grouped.this_errno); | ||||
| 	} | ||||
| 	system_printf ("child %d - %s, errno %d", grouped.child_pid, | ||||
| 		       grouped.errmsg, grouped.this_errno); | ||||
|  | ||||
|       set_errno (grouped.this_errno); | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user