From 867c5a928af760a5ea3570182737c5f8355134db Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Mon, 30 Oct 2023 13:34:57 +0900 Subject: [PATCH] using copyBytes --- Network/HPACK/HeaderBlock/Encode.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Network/HPACK/HeaderBlock/Encode.hs b/Network/HPACK/HeaderBlock/Encode.hs index 5cd88d3d..0e53bd12 100644 --- a/Network/HPACK/HeaderBlock/Encode.hs +++ b/Network/HPACK/HeaderBlock/Encode.hs @@ -11,9 +11,10 @@ module Network.HPACK.HeaderBlock.Encode ( import Control.Exception (bracket, throwIO) import qualified Control.Exception as E import qualified Data.ByteString as BS -import Data.ByteString.Internal (create, memcpy) +import Data.ByteString.Internal (create) import Data.IORef import Foreign.Marshal.Alloc (free, mallocBytes) +import Foreign.Marshal.Utils (copyBytes) import Foreign.Ptr (minusPtr) import Network.ByteOrder @@ -70,7 +71,7 @@ encodeHeader' stgy siz dyntbl hs = bracket (mallocBytes siz) free enc enc buf = do (hs', len) <- encodeTokenHeader buf siz stgy True dyntbl hs case hs' of - [] -> create len $ \p -> memcpy p buf len + [] -> create len $ \p -> copyBytes p buf len _ -> throwIO BufferOverrun ----------------------------------------------------------------