This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: tmpfile security hole


Jeff Johnston <jjohnstn <at> redhat.com> writes:

> 
> Yes, thanks.
> 

Done, with the additional fix to my patch that I just noticed:

> +  while (fd < 0 && ptr->_errno == EEXIST);
> +  if (fd < 0)
>      return NULL;
> -  fp = _fopen_r (ptr, f, "wb+");
> +  fp = _fdopen_r (ptr, fd, "wb+");
>    e = ptr->_errno;

Here, if fp is NULL, then fd needs to be closed.

>    _CAST_VOID _remove_r (ptr, f);
>    ptr->_errno = e;

-- 
Eric Blake



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]