Bug 451139 - "The return value of read() function should check in nsRandomAccessInputStream::readline instead of invoking failed()." [r=brendan sr=bsmedberg]

Index: xpcom/obsolete/nsFileStream.cpp
===================================================================
RCS file: /cvsroot/mozilla/xpcom/obsolete/nsFileStream.cpp,v
retrieving revision 1.5.28.1
This commit is contained in:
Hiroyuki Ikezoe 2008-10-01 00:06:04 -05:00
parent 54ca06a4e6
commit 00ce111e7d

View File

@ -235,7 +235,7 @@ PRBool nsRandomAccessInputStream::readline(char* s, PRInt32 n)
if (position < zero)
return PR_FALSE;
PRInt32 bytesRead = read(s, n - 1);
if (failed())
if (failed() || bytesRead < 0)
return PR_FALSE;
s[bytesRead] = '\0'; // always terminate at the end of the buffer
char* tp = strpbrk(s, "\n\r");