summaryrefslogtreecommitdiff
path: root/src/sds.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sds.c')
-rw-r--r--src/sds.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sds.c b/src/sds.c
index 0dc39bc43..1df1043ed 100644
--- a/src/sds.c
+++ b/src/sds.c
@@ -570,7 +570,7 @@ sds sdstrim(sds s, const char *cset) {
sp = start = s;
ep = end = s+sdslen(s)-1;
while(sp <= end && strchr(cset, *sp)) sp++;
- while(ep > start && strchr(cset, *ep)) ep--;
+ while(ep > sp && strchr(cset, *ep)) ep--;
len = (sp > ep) ? 0 : ((ep-sp)+1);
if (sh->buf != sp) memmove(sh->buf, sp, len);
sh->buf[len] = '\0';