diff --git a/src/xercesc/framework/XMLFormatter.cpp b/src/xercesc/framework/XMLFormatter.cpp
index d792a1acc79ffa88d2453fa739b5fe33d342de5e..ea9e7e5482524218554e94ec9abb5bfb300894f1 100644
--- a/src/xercesc/framework/XMLFormatter.cpp
+++ b/src/xercesc/framework/XMLFormatter.cpp
@@ -393,7 +393,7 @@ XMLFormatter::formatBuf(const   XMLCh* const    toFormat
 
                     // And bump up our pointer
                     srcPtr += charsEaten;
-                    srcCount -= srcChars;
+                    srcCount -= charsEaten;
                 }
             }
              else if (tmpPtr < endPtr)