This is the mail archive of the cygwin mailing list for the Cygwin 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]

Buggy fmemopen


This function causes SIGSEGV when it's called with buf == NULL. Also it
returns EINVAL with mode != "a".
It appears it wasn't tested with buf == NULL at all:
fmemopen.c:309
  if (!buf)
    {
      /* r+/w+/a+, and no buf: file starts empty.  */
      c->buf = (char *) (c + 1);
      *(char *) buf = '\0'; // Should be c->buf?
      c->pos = c->eof = 0;
      c->append = (flags & __SAPP) != 0;
    }
This condition looks strange:
fmemopen.c:284
  if (!size || !(buf || flags & __SAPP)) // Why?
    {
      ptr->_errno = EINVAL;
      return NULL;
    }

-- 
View this message in context: http://old.nabble.com/Buggy-fmemopen-tp30984430p30984430.html
Sent from the Cygwin list mailing list archive at Nabble.com.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


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