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) {
|
while(*mode) {
|
||||||
switch(*mode++) {
|
switch(*mode++) {
|
||||||
case 'b':
|
case 'b':
|
||||||
break;
|
continue;
|
||||||
case '+':
|
case '+':
|
||||||
flags |= _IOREAD | _IOWRITE;
|
flags |= _IOREAD | _IOWRITE;
|
||||||
break;
|
continue;
|
||||||
|
/* The sequence may be followed by aditional characters */
|
||||||
default:
|
default:
|
||||||
return (FILE *)NULL;
|
break;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stream = (FILE *) malloc(sizeof(FILE))) == NULL) {
|
if ((stream = (FILE *) malloc(sizeof(FILE))) == NULL) {
|
||||||
|
|
Loading…
Reference in a new issue