[hackers] [sbase] crypt: Fix hash line format compatibility || Quentin Rameau
commit 3c7df37bc636538d024937e891d0959a28c370f7
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Thu Apr 2 23:48:05 2026 +0200
Commit: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
CommitDate: Mon Apr 6 11:10:50 2026 +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.
diff --git a/libutil/crypt.c b/libutil/crypt.c
index e832b6f..e1d630e 100644
--- a/libutil/crypt.c
+++ b/libutil/crypt.c
_AT_@ -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;
}
Received on Mon Apr 06 2026 - 11:11:12 CEST
This archive was generated by hypermail 2.3.0
: Mon Apr 06 2026 - 11:12:21 CEST