delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/02/22/11:08:14

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Tue, 22 Feb 2011 17:07:27 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Buggy fmemopen
Message-ID: <20110222160727.GJ12399@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <30984430 DOT post AT talk DOT nabble DOT com>
MIME-Version: 1.0
In-Reply-To: <30984430.post@talk.nabble.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Feb 22 02:13, lumumba wrote:
> 
> 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;
>     }

This is a newlib issue in the first place, so the right mailing list
would have been newlib AT sourceware DOT org.  However, I just applied a
patch which should fix the issue.


Thanks for the report,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019