]> git.ipfire.org Git - thirdparty/openvpn.git/commit
Fix potential division by zero in shaper_reset()
authorGert Doering <gert@greenie.muc.de>
Tue, 8 Nov 2016 09:44:02 +0000 (10:44 +0100)
committerGert Doering <gert@greenie.muc.de>
Tue, 8 Nov 2016 10:17:04 +0000 (11:17 +0100)
commit9c3a9335ee77d8447bf47e464f4ab15964fb6f1b
treeae65d4ba6a67a1ba46761be7a0d03602c00473be
parent63bdc6ce66a970f0584bbb1d4a8cae98b36ee831
Fix potential division by zero in shaper_reset()

shaper_reset() is only ever called with "bytes_per_second" set to
a non-zero value - so the whole check "is it zero? if not, use
constrain_int() to make sure it is within bounds" is not needed ->
reduce check to just constrain_int() so even if somebody would
call shaper_reset(..., 0) it would not lead to a div-by-zero.

Found by Coverity.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <1478598242-23514-1-git-send-email-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg12942.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/shaper.h