From 2a40ee1121903847cdd3f6c5b4796e4d5471b2df Mon Sep 17 00:00:00 2001 From: Sjors Provoost Date: Mon, 8 Jul 2024 18:39:31 +0200 Subject: [PATCH] rpc: check for negative timeout arg in waitfor* --- src/rpc/blockchain.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 7c6ab578ea4..44334b7a390 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -296,6 +296,7 @@ static RPCHelpMan waitfornewblock() int timeout = 0; if (!request.params[0].isNull()) timeout = request.params[0].getInt(); + if (timeout < 0) throw JSONRPCError(RPC_MISC_ERROR, "Negative timeout"); CUpdatedBlock block; { @@ -343,6 +344,7 @@ static RPCHelpMan waitforblock() if (!request.params[1].isNull()) timeout = request.params[1].getInt(); + if (timeout < 0) throw JSONRPCError(RPC_MISC_ERROR, "Negative timeout"); CUpdatedBlock block; { @@ -391,6 +393,7 @@ static RPCHelpMan waitforblockheight() if (!request.params[1].isNull()) timeout = request.params[1].getInt(); + if (timeout < 0) throw JSONRPCError(RPC_MISC_ERROR, "Negative timeout"); CUpdatedBlock block; {