From e1cc6679207f73f46a0f689fbc64a15b0c1dbe51 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Mon, 2 Mar 2020 17:37:54 +0100 Subject: [PATCH] pubkey-speed: Add sanity check for the number of rounds The allocated buffer for the signatures is based on this, which LGTM doesn't like. --- scripts/pubkey_speed.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/pubkey_speed.c b/scripts/pubkey_speed.c index 83ab4e41b..21e4d2c1e 100644 --- a/scripts/pubkey_speed.c +++ b/scripts/pubkey_speed.c @@ -56,6 +56,10 @@ int main(int argc, char *argv[]) } rounds = atoi(argv[3]); + if (rounds < 0 || rounds > (2^26)) + { /* arbitrary limit to the number of chunk_t/sigs that fit into 1 GiB */ + usage(); + } if (streq(argv[2], "rsa")) {