From 7ecb259aaefc9179f4e59015b6d85497e699e01f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Ch=C3=A9ron?= Date: Tue, 7 May 2019 06:38:28 +0200 Subject: [PATCH] Fix LE.i2osp 0 Little-endian bytes are stored at the beginning of the buffer. --- Crypto/Number/Serialize/Internal/LE.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Crypto/Number/Serialize/Internal/LE.hs b/Crypto/Number/Serialize/Internal/LE.hs index 473d1de..d4c2594 100644 --- a/Crypto/Number/Serialize/Internal/LE.hs +++ b/Crypto/Number/Serialize/Internal/LE.hs @@ -31,7 +31,7 @@ i2osp :: Integer -> Ptr Word8 -> Int -> IO Int i2osp m ptr ptrSz | ptrSz <= 0 = return 0 | m < 0 = return 0 - | m == 0 = pokeByteOff ptr (sz-1) (0 :: Word8) >> return 1 + | m == 0 = pokeByteOff ptr 0 (0 :: Word8) >> return 1 | ptrSz < sz = return 0 | otherwise = fillPtr ptr sz m >> return sz where