sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

commit 3c7df37bc636538d024937e891d0959a28c370f7
parent 6bb5d0b24b807fa77efc79f72bc8c2a2285713c9
Author: Quentin Rameau <quinq@fifth.space>
Date:   Thu,  2 Apr 2026 23:48:05 +0200

crypt: Fix hash line format compatibility

According to the coreutils implementation man-page (of sha512sum),

> The sums are computed as described in FIPS-180-2.  When checking, the
> input should be a former output of this program.  The default mode is
> to print a line with: checksum, a space, a character indicating input
> mode ('*' for binary, ' ' for text or where binary is insignificant),
> and name for each FILE.

Diffstat:
Mlibutil/crypt.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libutil/crypt.c b/libutil/crypt.c @@ -49,7 +49,8 @@ mdchecklist(FILE *listfp, struct crypt_ops *ops, uint8_t *md, size_t sz, char *line = NULL, *file, *p; while (getline(&line, &bufsiz, listfp) > 0) { - if (!(file = strstr(line, " "))) { + file = strchr(line, ' '); + if (file == NULL || (file[1] != ' ' && file[1] != '*')) { (*formatsucks)++; continue; }