aboutsummaryrefslogtreecommitdiff
path: root/src/strings.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/strings.c')
-rw-r--r--src/strings.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/strings.c b/src/strings.c
index 46ef9ea..29d5b65 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -451,12 +451,12 @@ char *lstrip(char *sptr) {
* @return truncated string
*/
char *strip(char *sptr) {
- size_t len = strlen(sptr);
+ size_t len = strlen(sptr) - 1;
if (len < 1) {
*sptr = '\0';
return sptr;
}
- for (size_t i = len - 1; ; i--) {
+ for (size_t i = len; ; i--) {
if (isspace(sptr[i]) || isblank(sptr[i])) {
sptr[i] = '\0';
}