Index: libcfa/src/iostream.cfa
===================================================================
--- libcfa/src/iostream.cfa	(revision 416b44361690d969b5d06bb054b6451776e1f181)
+++ libcfa/src/iostream.cfa	(revision 553f032fc07a39fc4fc69943eb5e97e2504b74a1)
@@ -1,2 +1,3 @@
+
 //
 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
@@ -976,5 +977,10 @@
 		if ( f.flags.ignore ) { fmtstr[1] = '*'; start += 1; }
 		// no maximum width necessary because text ignored => width is read width
-		if ( f.wd != -1 ) { start += sprintf( &fmtstr[start], "%d", f.wd ); }
+		if ( f.wd != -1 ) {
+			// wd is buffer bytes available (for input chars + null terminator)
+			// rwd is count of input chars
+			int rwd = f.flags.rwd ? f.wd : (f.wd - 1);
+			start += sprintf( &fmtstr[start], "%d", rwd );
+		}
 
 		if ( ! scanset ) {
@@ -993,5 +999,5 @@
 		} // if
 
-		int check = f.wd - 1;
+		int check = f.wd - 2;
 		if ( ! f.flags.rwd ) f.s[check] = '\0';			// insert sentinel
 		len = fmt( is, fmtstr, f.s );
