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 --- service/src/.gitignore | 1 - service/src/util.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 service/src/.gitignore (limited to 'service') diff --git a/service/src/.gitignore b/service/src/.gitignore deleted file mode 100644 index 378eac2..0000000 --- a/service/src/.gitignore +++ /dev/null @@ -1 +0,0 @@ -build diff --git a/service/src/util.c b/service/src/util.c index d8b9c98..833c373 100644 --- a/service/src/util.c +++ b/service/src/util.c @@ -49,6 +49,7 @@ mhash(const char *str, int len) int i, k, v; char c, *bp; + 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