]> jfr.im git - solanum.git/commit
librb/src/crypt.c: rb_sha*_crypt_r: avoid UB pointer math
authorAaron Jones <redacted>
Wed, 24 Aug 2022 23:51:14 +0000 (23:51 +0000)
committerDoug Freed <redacted>
Thu, 25 Aug 2022 00:03:22 +0000 (20:03 -0400)
commitae510cce126196cc0411cee57f1e548ea6126d6e
tree1ec77802c204d791e47ebf0c50c290243e6fbeb3
parent0302f1532b66e9d09b70f9f65fd6652c2034f91e
librb/src/crypt.c: rb_sha*_crypt_r: avoid UB pointer math

This code is doing (foo - (char*)0) to convert foo from a pointer
value into a numeric value. Unfortunately, this is undefined
behaviour, which clang-14 is now warning about [1].

Cast to uintptr_t instead. Same result, but well-defined.

[1] cf. commit 0302f1532b66e9d09b70
librb/src/crypt.c