summaryrefslogtreecommitdiffstats
path: root/source3/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util_str.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 67d3b2108e..1a2c2bef1f 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -299,7 +299,7 @@ BOOL trim_string(char *s,const char *front,const char *back)
}
if (back_len) {
- while (strncmp(s+len-back_len,back,back_len)==0) {
+ while ((len >= back_len) && strncmp(s+len-back_len,back,back_len)==0) {
s[len-back_len]='\0';
len -= back_len;
ret=True;