diff --git a/CMark.hsc b/CMark.hsc
--- a/CMark.hsc
+++ b/CMark.hsc
@@ -38,7 +38,7 @@
 import GHC.Generics (Generic)
 import Data.Data (Data)
 import Data.Typeable (Typeable)
-import Data.Text (Text, empty)
+import Data.Text (Text, empty, snoc)
 import qualified Data.Text.Foreign as TF
 import Data.ByteString.Unsafe (unsafePackMallocCString)
 import Data.Text.Encoding (decodeUtf8)
@@ -384,7 +384,7 @@
   | otherwise      = TF.peekCStringLen (str, c_strlen str)
 
 withtext :: Text -> (CString -> IO a) -> IO a
-withtext t f = TF.withCStringLen t (f . fst)
+withtext t f = TF.withCStringLen (snoc t '\0') (f . fst)
 
 foreign import ccall "string.h strlen"
     c_strlen :: CString -> Int
diff --git a/changelog b/changelog
--- a/changelog
+++ b/changelog
@@ -1,14 +1,24 @@
+cmark 0.5.6.3 (13 Mar 2019)
+
+  * Use snoc instead of <> to add the null terminator.
+
+cmark 0.5.6.2 (13 Mar 2019)
+
+  * Ensure that withtext adds a null terminator (#14).
+    This fixes a regression due to PR #13, which caused
+    random content to appear in rendered TEXT nodes.
+
 cmark 0.5.6.1 (11 Mar 2019)
 
   * Fix CString memory leaks (Anders Kaseorg).  The renderer functions return
-    a malloc’d string which the caller is expected to free.
+  a malloc’d string which the caller is expected to free.
 
   * Fix use-after-free bugs (Anders Kaseorg).  `useAsCString` frees the
-    CString after the IO action finishes executing, so passing `return` as that
-    action can never be correct.  To make sure the CString gets freed at the
-    right time, we need a “with”-style abstraction, not just a conversion
-    function.  While we’re here replace this with `withCStringLen`, which also
-    makes fewer copies.
+    CString after the IO action finishes executing, so passing `return` as
+    that action can never be correct.  To make sure the CString gets freed
+    at the right time, we need a “with”-style abstraction, not just a
+    conversion function.  While we’re here replace this with
+    `withCStringLen`, which also makes fewer copies.
 
   * Show node type on error for unknown node type.
 
diff --git a/cmark.cabal b/cmark.cabal
--- a/cmark.cabal
+++ b/cmark.cabal
@@ -1,5 +1,5 @@
 name:                cmark
-version:             0.5.6.1
+version:             0.5.6.3
 synopsis:            Fast, accurate CommonMark (Markdown) parser and renderer
 description:
   This package provides Haskell bindings for
@@ -42,7 +42,7 @@
                      cbits/entities.inc
                      bench/sample.md
                      bench/full-sample.md
-cabal-version:       >=1.14
+cabal-version:       1.14
 
 Source-repository head
   type:              git
