aboutsummaryrefslogtreecommitdiff
path: root/src/libnpass
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-04-16 15:19:53 +0530
committersinanmohd <sinan@sinanmohd.com>2024-04-16 15:20:35 +0530
commit7e7f2da14ad9ec9b1cabe3061147300fcdf93039 (patch)
treece469c2e6c95dc010cd8dc06e97755be66c3da20 /src/libnpass
parent42e609321472f3796f010a1d32a39785c4328576 (diff)
libnpass/util/util_strtrim: safely handle 0 length C strings
Diffstat (limited to 'src/libnpass')
-rw-r--r--src/libnpass/util.c3
1 files changed, 2 insertions, 1 deletions
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';
}