From: Adrian M. Enache <enache@rdslink.ro>
Date: Sat, 19 Apr 2003 20:12:18 +0000 (+0300)
Subject: Re: [perl #22000] AutoReply: [PATCH] Naughty sv_gets/RsRECORD bug
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=27e6ca2de6da17a5bf31160fd2bf3a6f71c67bd6;p=p5sagit%2Fp5-mst-13.2.git

Re: [perl #22000] AutoReply: [PATCH] Naughty sv_gets/RsRECORD bug
Message-ID: <20030419171218.GA974@ratsnest.hole>

p4raw-id: //depot/perl@19281
---

diff --git a/sv.c b/sv.c
index 5280c08..4563809 100644
--- a/sv.c
+++ b/sv.c
@@ -6379,6 +6379,8 @@ Perl_sv_gets(pTHX_ register SV *sv, register PerlIO *fp, I32 append)
 #else
       bytesread = PerlIO_read(fp, buffer, recsize);
 #endif
+      if (bytesread < 0)
+	  bytesread = 0;
       SvCUR_set(sv, bytesread += append);
       buffer[bytesread] = '\0';
       goto return_string_or_null;