public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: lumumba <a37fce657@yahoo.com>
To: cygwin@cygwin.com
Subject: Buggy fmemopen
Date: Tue, 22 Feb 2011 10:13:00 -0000	[thread overview]
Message-ID: <30984430.post@talk.nabble.com> (raw)


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

             reply	other threads:[~2011-02-22 10:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-22 10:13 lumumba [this message]
2011-02-22 16:08 ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=30984430.post@talk.nabble.com \
    --to=a37fce657@yahoo.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).