diff --git a/ChangeLog.md b/ChangeLog.md
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,5 +1,8 @@
 See also http://pvp.haskell.org/faq
 
+## 0.95.1.1.8.44
+- Fix: `asCString` for `Text` regexes doesn't check for null-termination, causing the compiled regex to be corrupted. (@kuribas)
+
 ## 0.95.1.0.8.43
 
 - Update to `regex-0.94.0.0` API
diff --git a/regex-pcre-builtin.cabal b/regex-pcre-builtin.cabal
--- a/regex-pcre-builtin.cabal
+++ b/regex-pcre-builtin.cabal
@@ -1,5 +1,5 @@
 Name:                   regex-pcre-builtin
-Version:                0.95.1.1.8.43
+Version:                0.95.1.1.8.44
 Cabal-Version:          >=1.10
 stability:              Seems to work, passes a few tests
 build-type:             Simple
@@ -55,7 +55,7 @@
       FlexibleInstances
 
   build-depends: regex-base == 0.94.*
-               , base       >= 4.3 && < 4.14
+               , base       >= 4.3 && < 4.15
                , containers >= 0.4 && < 0.7
                , bytestring >= 0.9 && < 0.11
                , array      >= 0.3 && < 0.6
diff --git a/src/Text/Regex/PCRE/Text.hs b/src/Text/Regex/PCRE/Text.hs
--- a/src/Text/Regex/PCRE/Text.hs
+++ b/src/Text/Regex/PCRE/Text.hs
@@ -50,6 +50,9 @@
   ) where
 
 import           Data.Array(Array,listArray)
+import           Data.Char(ord)
+import           Control.Monad.Fail (fail)
+import           Prelude hiding (fail)
 import qualified Data.ByteString              as B
 import qualified Data.ByteString.Unsafe       as B
 import qualified Data.Text                    as T
@@ -154,7 +157,9 @@
 
 {-# INLINE asCString #-}
 asCString :: T.Text -> (CString->IO a) -> IO a
-asCString = B.unsafeUseAsCString . T.encodeUtf8
+asCString t
+  | T.null t || (ord (T.last t) /= 0) = B.useAsCString $ T.encodeUtf8 t
+  | otherwise = B.unsafeUseAsCString $ T.encodeUtf8 t
 
 {-# INLINE asCStringLen #-}
 asCStringLen :: T.Text -> (CStringLen->IO a) -> IO a
