scan_scaled: fix rescaling for negative numbers
authortb <tb@openbsd.org>
Sun, 20 Jun 2021 14:08:42 +0000 (14:08 +0000)
committertb <tb@openbsd.org>
Sun, 20 Jun 2021 14:08:42 +0000 (14:08 +0000)
commitf4be339cc4235e94d7b8e62114a6b2ead003fb34
tree9d0e6fc3c01a621e3f539538b706a2eb67eb82b2
parentb26de507dd722693b172902f717b5d4950ee6717
scan_scaled: fix rescaling for negative numbers

As found by djm by fuzzing ssh, scan_scaled can overflow for negative
numbers when rescaling is needed. This is because the rescaled fractional
part is added without taking the sign into account.

ok ian jca
lib/libutil/fmt_scaled.c