From e7b97f2edf17990be192d95ed42b2431b3060249 Mon Sep 17 00:00:00 2001 From: Louis Burda Date: Mon, 14 Jun 2021 18:07:37 +0200 Subject: mhash: fix empty input string problem with division by 0 --- src/util.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/util.c') diff --git a/src/util.c b/src/util.c index 8bd8448..7a57d38 100644 --- a/src/util.c +++ b/src/util.c @@ -52,6 +52,7 @@ mhash(const char *str, int len) /* VULN #2: BUFFER OVERFLOW */ /* see documentation/README.md for more details */ + if (!str || !*str) str = "."; if (len == -1) len = strlen(str); for (v = 0, i = 0; i < len; i++) v += str[i]; -- cgit v1.2.3-71-gd317