diff --git a/System/Posix/Env/ByteString.hsc b/System/Posix/Env/ByteString.hsc
index 5780ca413e2100055e3bd6427208c0e9e1c4e85f..0b2fe6f8bdcd1bb17507579748b7a64fc8a92244 100644
--- a/System/Posix/Env/ByteString.hsc
+++ b/System/Posix/Env/ByteString.hsc
@@ -42,7 +42,7 @@ import System.Posix.Env ( clearEnv )
 import qualified Data.ByteString as B
 import qualified Data.ByteString.Char8 as BC
 import Data.ByteString (ByteString)
-import Data.ByteString.Internal (ByteString (PS), memcpy)
+import Data.ByteString.Internal (ByteString (PS))
 
 import qualified System.Posix.Env.Internal as Internal
 
@@ -133,7 +133,7 @@ putEnv (PS fp o l) = withForeignPtr fp $ \p -> do
   --
   -- hence we must not free the buffer
   buf <- mallocBytes (l+1)
-  memcpy buf (p `plusPtr` o) l
+  copyBytes buf (p `plusPtr` o) l
   pokeByteOff buf l (0::Word8)
   throwErrnoIfMinus1_ "putenv" (c_putenv (castPtr buf))
 
diff --git a/unix.cabal b/unix.cabal
index 73f69ba9e72e089c467fac3420cf3204787114b6..104d2626c9426e84983f12c7dd84703820c2dcf0 100644
--- a/unix.cabal
+++ b/unix.cabal
@@ -70,7 +70,7 @@ library
 
     build-depends:
         base        >= 4.10    && < 4.20,
-        bytestring  >= 0.9.2   && < 0.12,
+        bytestring  >= 0.9.2   && < 0.13,
         filepath    >= 1.4.100.0 && < 1.5,
         time        >= 1.2     && < 1.13