From d3e56f1075cb72dc2ac5b2999a042bbc79814400 Mon Sep 17 00:00:00 2001 From: devgs Date: Thu, 16 Sep 2021 11:43:46 +0300 Subject: [PATCH] Closed the gate for buffer overrun In case if a string length matches the length of a buffer, the function will return a non-null-terminated string. --- libopendmarc/opendmarc_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libopendmarc/opendmarc_util.c b/libopendmarc/opendmarc_util.c index 4ab8ac0c..86cc69b1 100644 --- a/libopendmarc/opendmarc_util.c +++ b/libopendmarc/opendmarc_util.c @@ -160,7 +160,7 @@ opendmarc_util_cleanup(u_char *str, u_char *buf, size_t buflen) { char *sp, *ep; - if (str == NULL || buf == NULL || strlen((char *)str) > buflen) + if (str == NULL || buf == NULL || strlen((char *)str) >= buflen) { errno = EINVAL; return NULL;