delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2000/02/25/11:57:57

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-developers-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com
Message-ID: <779F20BCCE5AD31186A50008C75D99791716E4@SILLDN_MAIL1>
From: "Fifer, Eric" <EFifer AT sanwaint DOT com>
To: "'Chris Faylor'" <cgf AT cygnus DOT com>
Cc: "'jjohnstn AT cygnus DOT com'" <jjohnstn AT cygnus DOT com>,
"'cygwin-developers AT sourceware DOT cygnus DOT com'"
<cygwin-developers AT sourceware DOT cygnus DOT com>
Subject: RE: [jjohnstn AT cygnus DOT com: Re: A patch from the net]
Date: Fri, 25 Feb 2000 17:03:28 -0000
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2448.0)

Thanks for fowarding the stdout problem.

Also, the end of last month I sent in a different newlib problem,
but never got any kind of acknowledgement.  I'll attach the old
email, just in case the issue fell through the cracks ...

Eric

--

Sent: Monday, January 31, 2000 3:44 PM
To: cygwin-developers AT sourceware DOT cygnus DOT com
Subject: fopen looking past end of mode string

When fopen is checking its mode flags, it can look past
the end of the string.  This patch checks that mode[1] is
not a terminator before looking ahead to mode[2].

Eric Fifer

--- newlib/libc/stdio/flags.c-  Thu Oct 14 18:37:59 1999
+++ newlib/libc/stdio/flags.c   Mon Jan 31 14:33:53 2000
@@ -61,19 +61,19 @@
       ptr->_errno = EINVAL;
       return (0);
     }
-  if (mode[1] == '+' || mode[2] == '+')
+  if (mode[1] && (mode[1] == '+' || mode[2] == '+'))
     {
       ret = __SRW;
       m = O_RDWR;
     }
-  if (mode[1] == 'b' || mode[2] == 'b')
+  if (mode[1] && (mode[1] == 'b' || mode[2] == 'b'))
     {
 #ifdef O_BINARY
       m |= O_BINARY;
 #endif
     }
 #ifdef __CYGWIN__
-  else if (mode[1] == 't' || mode[2] == 't')
+  else if (mode[1] && (mode[1] == 't' || mode[2] == 't'))
 #else
   else
 #endif

- Raw text -


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