From 1532ffe2159ec10d2ff4a77d6177a077b7e31c2a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 6 Mar 2016 23:41:08 +0100 Subject: [PATCH] protocol/ArgParser: fix range check The old check unsigned(value) > std::numeric_limits::max() .. cannot ever fail. --- src/protocol/ArgParser.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/protocol/ArgParser.cxx b/src/protocol/ArgParser.cxx index e373827b4..bdc1b95d1 100644 --- a/src/protocol/ArgParser.cxx +++ b/src/protocol/ArgParser.cxx @@ -92,7 +92,7 @@ check_range(Client &client, unsigned *value_r1, unsigned *value_r2, return false; } - if (unsigned(value) > std::numeric_limits::max()) { + if (value > std::numeric_limits::max()) { command_error(client, ACK_ERROR_ARG, "Number too large: %s", s); return false; @@ -117,7 +117,7 @@ check_range(Client &client, unsigned *value_r1, unsigned *value_r2, return false; } - if (unsigned(value) > std::numeric_limits::max()) { + if (value > std::numeric_limits::max()) { command_error(client, ACK_ERROR_ARG, "Number too large: %s", s); return false;