~ chicken-core (chicken-5) fa9ccaa030cf7acaceb15378a4d6c33464f0eb1f


commit fa9ccaa030cf7acaceb15378a4d6c33464f0eb1f
Author:     Peter Bex <peter.bex@xs4all.nl>
AuthorDate: Sat Feb 16 14:01:08 2013 +0100
Commit:     Christian Kellermann <ckeen@pestilenz.org>
CommitDate: Sat Feb 16 16:18:10 2013 +0100

    Get rid of overflow situation in read-line causing lines to be read wrong
    
    Signed-off-by: Christian Kellermann <ckeen@pestilenz.org>

diff --git a/posixunix.scm b/posixunix.scm
index 251c400d..650d2c33 100644
--- a/posixunix.scm
+++ b/posixunix.scm
@@ -1388,7 +1388,7 @@ EOF
 		       (fetch))
 		     (if (fx>= bufpos buflen)
 			 #!eof
-			 (let ((limit (or limit (##sys#fudge 21))))
+			 (let ((limit (or limit (fx- (##sys#fudge 21) bufpos))))
 			   (receive (next line)
 			       (##sys#scan-buffer-line
 				buf
diff --git a/tcp.scm b/tcp.scm
index d0657a4b..758c7d20 100644
--- a/tcp.scm
+++ b/tcp.scm
@@ -433,7 +433,7 @@ EOF
 		   (read-input))
 		 (if (fx>= bufindex buflen)
 		     #!eof
-		     (let ((limit (or limit (##sys#fudge 21))))
+		     (let ((limit (or limit (fx- (##sys#fudge 21) bufindex))))
 		       (receive (next line)
 			   (##sys#scan-buffer-line
 			    buf
Trap