diff --git a/src/Text/Sundown/Buffer/Foreign.hsc b/src/Text/Sundown/Buffer/Foreign.hsc
--- a/src/Text/Sundown/Buffer/Foreign.hsc
+++ b/src/Text/Sundown/Buffer/Foreign.hsc
@@ -28,10 +28,10 @@
   alignment _ = alignment (undefined :: CInt)
   peek ptr = do
     d  <- (#peek struct buf, data) ptr
+    s  <- (#peek struct buf, size) ptr
     dbs <- if d == nullPtr
            then return $ BS.pack [0]
-           else BS.packCString d
-    s  <- (#peek struct buf, size) ptr
+           else BS.packCStringLen (d, s)
     as <- (#peek struct buf, asize) ptr
     u  <- (#peek struct buf, unit) ptr
     r  <- (#peek struct buf, ref) ptr
diff --git a/sundown.cabal b/sundown.cabal
--- a/sundown.cabal
+++ b/sundown.cabal
@@ -1,6 +1,6 @@
 Cabal-version:          >= 1.6
 Name:                   sundown
-Version:                0.1.1
+Version:                0.1.2
 Author:                 Francesco Mazzoli (f@mazzo.li)
 Maintainer:             Francesco Mazzoli (f@mazzo.li)
 Build-Type:             Simple
