pgsql: Fix integer-overflow problem in scram_SaltedPassword() - Mailing list pgsql-committers

From Richard Guo
Subject pgsql: Fix integer-overflow problem in scram_SaltedPassword()
Date
Msg-id E1txMQX-0013hu-0t@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix integer-overflow problem in scram_SaltedPassword()

Setting the iteration count for SCRAM secret generation to INT_MAX
will cause an infinite loop in scram_SaltedPassword() due to integer
overflow, as the loop uses the "i <= iterations" comparison.  To fix,
use "i < iterations" instead.

Back-patch to v16 where the user-settable GUC scram_iterations has
been added.

Author: Kevin K Biju <kevinkbiju@gmail.com>
Reviewed-by: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAM45KeEMm8hnxdTOxA98qhfZ9CzGDdgy3mxgJmy0c+2WwjA6Zg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7c82b4f711877b175142bb2b2a6e2c2ee2429441

Modified Files
--------------
src/common/scram-common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)


pgsql-committers by date:

Previous
From: Michael Paquier
Date:
Subject: pgsql: Use relation name instead of OID in query jumbling for RangeTblE
Next
From: Richard Guo
Date:
Subject: pgsql: Fix integer-overflow problem in scram_SaltedPassword()