crypt: Improve hash length verification - sbase - suckless unix tools
HTML git clone git://git.suckless.org/sbase
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 6bb5d0b24b807fa77efc79f72bc8c2a2285713c9
DIR parent 8b842c789c63b376f054d65163d7c7cc279e147c
HTML Author: Quentin Rameau <quinq@fifth.space>
Date: Thu, 2 Apr 2026 23:45:53 +0200
crypt: Improve hash length verification
The current version would not detect incorrect hashes
of one more character than expected.
Diffstat:
M libutil/crypt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
DIR diff --git a/libutil/crypt.c b/libutil/crypt.c
@@ -53,7 +53,7 @@ mdchecklist(FILE *listfp, struct crypt_ops *ops, uint8_t *md, size_t sz,
(*formatsucks)++;
continue;
}
- if ((file - line) / 2 != sz) {
+ if (file - line != sz * 2) {
(*formatsucks)++; /* checksum length mismatch */
continue;
}