garbage is allowed in the fdopen mode string
This commit is contained in:
		
							parent
							
								
									470bb82342
								
							
						
					
					
						commit
						536b12010f
					
				
					 1 changed files with 5 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -34,13 +34,15 @@ fdopen(int fd, const char *mode)
 | 
			
		|||
	while(*mode) {
 | 
			
		||||
		switch(*mode++) {
 | 
			
		||||
		case 'b':
 | 
			
		||||
			break;
 | 
			
		||||
			continue;
 | 
			
		||||
		case '+':
 | 
			
		||||
			flags |= _IOREAD | _IOWRITE;
 | 
			
		||||
			break;
 | 
			
		||||
			continue;
 | 
			
		||||
		/* The sequence may be followed by aditional characters */
 | 
			
		||||
		default:
 | 
			
		||||
			return (FILE *)NULL;
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if ((stream = (FILE *) malloc(sizeof(FILE))) == NULL) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue