aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2023-05-09 17:59:13 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2023-05-10 09:25:21 +0000
commitf1ceb05a469ffe03f25aeea5f9f72a6d8f75bcd1 (patch)
tree463f1280646e3688e7a903817a2f00b4b773ae41
parent0e04dd3b66c053422b90c387f7bbd82a0921bda0 (diff)
downloadsrc-f1ceb05a469ffe03f25aeea5f9f72a6d8f75bcd1.tar.gz
src-f1ceb05a469ffe03f25aeea5f9f72a6d8f75bcd1.zip
md5: Fix input error check.
Fixes: 4849767cb16a MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: tsoome, kevans, lwhsu Differential Revision: https://reviews.freebsd.org/D40017
-rw-r--r--sbin/md5/md5.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sbin/md5/md5.c b/sbin/md5/md5.c
index 98cfb37110d5..bca6a98fc32c 100644
--- a/sbin/md5/md5.c
+++ b/sbin/md5/md5.c
@@ -686,7 +686,7 @@ MDInput(const Algorithm_t *alg, FILE *f, char *buf, bool tee)
switch (input_mode) {
case input_binary:
case input_text:
- if (tee && fwrite(block, 1, len, stdout) != (size_t)len)
+ if (tee && fwrite(block, 1, len, stdout) != len)
err(1, "stdout");
alg->Update(&context, block, len);
break;
@@ -734,7 +734,7 @@ MDInput(const Algorithm_t *alg, FILE *f, char *buf, bool tee)
break;
}
}
- if (len < 0) {
+ if (ferror(f)) {
alg->End(&context, buf);
return (NULL);
}