enowars5-service-stldoctor

STL-Analyzing A/D Service for ENOWARS5 in 2021
git clone https://git.sinitax.com/sinitax/enowars5-service-stldoctor
Log | Files | Refs | README | LICENSE | sfeed.txt

commit e7b97f2edf17990be192d95ed42b2431b3060249
parent 1dae95e69db1ed2155599cfe582517307ebc1bcf
Author: Louis Burda <quent.burda@gmail.com>
Date:   Mon, 14 Jun 2021 18:07:37 +0200

mhash: fix empty input string problem with division by 0

Diffstat:
Dservice/src/.gitignore | 1-
Mservice/src/util.c | 1+
Msrc/util.c | 1+
3 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/service/src/.gitignore b/service/src/.gitignore @@ -1 +0,0 @@ -build diff --git 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]; diff --git 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];