From 7e7f2da14ad9ec9b1cabe3061147300fcdf93039 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Tue, 16 Apr 2024 15:19:53 +0530 Subject: libnpass/util/util_strtrim: safely handle 0 length C strings --- src/libnpass/util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libnpass/util.c b/src/libnpass/util.c index 7f2f488..3b5e052 100644 --- a/src/libnpass/util.c +++ b/src/libnpass/util.c @@ -69,5 +69,6 @@ void util_strtrim(char *s) if (!isspace(*s)) rend = s; - rend[1] = '\0'; + if (*rend) + rend[1] = '\0'; } -- cgit v1.2.3