This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [perl #24225] [5.8.1] segfault in binmode STDOUT, ':stdio'; print 1
authorSlaven Rezic <slaven@rezic.de>
Sun, 19 Oct 2003 17:54:59 +0000 (19:54 +0200)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Mon, 20 Oct 2003 19:22:38 +0000 (19:22 +0000)
Message-ID: <871xt9te7g.fsf@vran.herceg.de>

p4raw-id: //depot/perl@21505

perlio.c

index faa3b19..c4a81af 100644 (file)
--- a/perlio.c
+++ b/perlio.c
@@ -2613,8 +2613,10 @@ char *
 PerlIOStdio_mode(const char *mode, char *tmode)
 {
     char *ret = tmode;
-    while (*mode) {
-       *tmode++ = *mode++;
+    if (mode) {
+       while (*mode) {
+           *tmode++ = *mode++;
+       }
     }
 #if defined(PERLIO_USING_CRLF) || defined(__CYGWIN__)
     *tmode++ = 'b';