| www.delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-SWARE-Spam-Status: | No, hits=3.3 required=5.0 tests=BAYES_50,DKIM_ADSP_CUSTOM_MED,FORGED_YAHOO_RCVD,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,T_RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL |
| X-Spam-Check-By: | sourceware.org |
| Message-ID: | <30984430.post@talk.nabble.com> |
| Date: | Tue, 22 Feb 2011 02:13:20 -0800 (PST) |
| From: | lumumba <a37fce657 AT yahoo DOT com> |
| To: | cygwin AT cygwin DOT com |
| Subject: | Buggy fmemopen |
| MIME-Version: | 1.0 |
| X-IsSubscribed: | yes |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.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 |
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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |