]> Repositorios git - scryer-prolog.git/commitdiff
type check for length argument in crypto_data_hkdf/4
authorMarkus Triska <[email protected]>
Mon, 18 May 2020 09:12:59 +0000 (11:12 +0200)
committerMarkus Triska <[email protected]>
Mon, 18 May 2020 09:12:59 +0000 (11:12 +0200)
Reported by @notoria in #527.

src/prolog/lib/crypto.pl

index 7a24643222556f2d2fd3e672741d87522f03e5e8..419c3d4c54bc3476b12275674865a3e77bf726c3 100644 (file)
@@ -250,6 +250,8 @@ hash_algorithm(sha512_256).
 
 crypto_data_hkdf(Data0, L, Bytes, Options0) :-
         functor_hash_options(algorithm, Algorithm, Options0, Options),
+        must_be(integer, L),
+        L >= 0,
         option(encoding(Encoding), Options, utf8),
         encoding_bytes(Encoding, Data0, Data),
         option(salt(SaltBytes), Options, []),