Fix use of invalid file descriptor
PATCH 1/1 Fix use of invalid file descriptor
From: Vegard Nossum <[email protected]>
Date: Sun, 25 May 2008 09:41:29 +0200
Subject: [PATCH] Fix use of invalid file descriptor
tokenize_buffer() calls setup_stream() with a file descriptor argument of -1. This number makes it all the way into nextchar_slow(), where -1 is used as an actual file descriptor when calling read().
Check for the -1 before calling read() if the buffer is empty.
(By the way, that read() there is probably missing some additional error
handling. An EINTR at the right moment...)
Signed-off-by Vegard Nossum <[email protected]>
--- tokenize.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
tokenize.c +2 -0
@@ -213,6 +213,8 @@ restart: repeat:if (offset >= size) { +if (stream->fd <0 ) + goto got_eof; size =read (stream->fd, stream->buffer,BUFSIZE );if (size <=0 ) goto got_eof;
Signature · 1 line
1.5.4.1