From bce218b33964481e02438ebf4471f648a2347b59 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Wed, 7 Nov 2018 02:39:25 +0000 Subject: [PATCH] Unfix the fix for an off-by-zero. arg_ulong_index_integer(argno, n) takes n as _exclusive_ upper bound. In this case, n - 64 is a valid starting index. So the exclusive upper bound is n - 64 + 1 = n - 63. --- src/microcode/prchacha.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/microcode/prchacha.c b/src/microcode/prchacha.c index 1bfa74fe4..bc77900f1 100644 --- a/src/microcode/prchacha.c +++ b/src/microcode/prchacha.c @@ -36,7 +36,7 @@ do_chacha_core (void (*core) (uint8_t *, const uint8_t *, const uint8_t *, if (noutput < 64) error_bad_range_arg (1); - unsigned long offset = (arg_ulong_index_integer (2, (noutput - 64))); + unsigned long offset = (arg_ulong_index_integer (2, (noutput - 64 + 1))); unsigned long ninput; const uint8_t * input = (arg_bytevector (3, (&ninput))); -- 2.25.1