diff --git a/src/Text/XML/Basic/Entity.hs b/src/Text/XML/Basic/Entity.hs
--- a/src/Text/XML/Basic/Entity.hs
+++ b/src/Text/XML/Basic/Entity.hs
@@ -38,7 +38,8 @@
       ds       -> readBounded 10 Char.isDigit    ds
 
 {- |
-We fail on leading zeros in order to prevent infinite loop on @repeat '0'@.
+We fail on too many leading zeros
+in order to prevent infinite loop on @repeat '0'@.
 This function assumes that @16 * ord maxBound@ is always representable as @Int@.
 -}
 readBounded :: Int -> (Char -> Bool) -> String -> Exceptional String Int
@@ -47,17 +48,17 @@
       ""  -> throw "empty number string"
       "0" -> return 0
       _ ->
-         let m digit =
+         let m pos digit =
                Update $ \mostSig ->
                   let n = mostSig*base + Char.digitToInt digit
                   in  assert ("invalid character "++show digit)
                          (validChar digit) >>
-                      assert "leading zero not allowed for security reasons"
-                         (not (mostSig==0 && digit=='0')) >>
+                      assert "too many leading zeros forbidden in order to prevent denial of service"
+                         (not (pos>=8 && digit=='0')) >>
                       assert "number too big"
                          (n <= Char.ord maxBound) >>
                       return n
-         in  evalUpdate (mconcat $ map m str) 0
+         in  evalUpdate (mconcat $ zipWith m [(0::Int)..] str) 0
 
 
 newtype Update e a = Update {evalUpdate :: a -> Exceptional e a}
diff --git a/xml-basic.cabal b/xml-basic.cabal
--- a/xml-basic.cabal
+++ b/xml-basic.cabal
@@ -1,6 +1,6 @@
 Cabal-Version:    2.2
 Name:             xml-basic
-Version:          0.1.3.2
+Version:          0.1.3.3
 License:          BSD-3-Clause
 License-File:     LICENSE
 Author:           Henning Thielemann <haskell@henning-thielemann.de>
@@ -24,7 +24,7 @@
 Source-Repository this
   type:     darcs
   location: http://code.haskell.org/~thielema/xml-basic/
-  tag:      0.1.3.2
+  tag:      0.1.3.3
 
 Library
   Build-Depends:
@@ -32,7 +32,7 @@
     data-accessor >=0.2 && <0.3,
     semigroups >=0.1 && <1.0,
     utility-ht >=0.0.13 && <0.1,
-    containers >=0.1 && <0.7,
+    containers >=0.1 && <0.8,
     base >= 2 && <5
   If impl(jhc)
     Build-Depends:
