From aa677d07a1b9846933410c7e5d0e92a4cbfb5444 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Wed, 23 May 2018 11:45:46 +0000 Subject: [PATCH] md5: perform compare case-insenstive md5 generates a md5 hash lowercase, but it might be provided in uppercase. Allow this. PR: 205598 Reported by: ohauer MFC After: 2 weeks --- sbin/md5/md5.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/md5/md5.c b/sbin/md5/md5.c index 9f54d60c193a..858e80b5d010 100644 --- a/sbin/md5/md5.c +++ b/sbin/md5/md5.c @@ -243,7 +243,7 @@ main(int argc, char *argv[]) else printf("%s (%s) = %s", Algorithm[digest].name, *argv, p); - if (checkAgainst && strcmp(checkAgainst,p)) + if (checkAgainst && strcasecmp(checkAgainst, p) != 0) { checksFailed++; if (!qflag) @@ -282,7 +282,7 @@ MDString(const Algorithm_t *alg, const char *string) printf("%s \"%s\"", buf, string); else printf("%s (\"%s\") = %s", alg->name, string, buf); - if (checkAgainst && strcmp(buf,checkAgainst)) + if (checkAgainst && strcasecmp(buf,checkAgainst) != 0) { checksFailed++; if (!qflag)