diff --git a/code/fd-stream.lisp b/code/fd-stream.lisp
index 62e48d76bf463fb6b4eb8dc08c73342fc2a3f5bf..23a6dd164eb21b981565c64ddc253036d6d2884f 100644
--- a/code/fd-stream.lisp
+++ b/code/fd-stream.lisp
@@ -5,7 +5,7 @@
 ;;; Carnegie Mellon University, and has been placed in the public domain.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/fd-stream.lisp,v 1.117 2010/08/15 13:03:43 rtoy Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/fd-stream.lisp,v 1.118 2010/08/18 16:42:06 rtoy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -1716,9 +1716,10 @@
 			 ;; Note: string-index starts at 1 (because
 			 ;; index 0 is for the unread-char), but
 			 ;; octet-count doesn't use that.  Hence,
-			 ;; subtract one from string-index.
+			 ;; subtract one from string-index and
+			 ;; string-buffer-len.
 			 (loop for k of-type fixnum from (1- (fd-stream-string-index stream))
-			    below (fd-stream-string-buffer-len stream)
+			    below (1- (fd-stream-string-buffer-len stream))
 			    do (decf posn (aref ocount k)))))
 		     (decf posn (- (fd-stream-ibuf-tail stream)
 				   (fd-stream-ibuf-head stream))))