Skip to content

Commit d24529f

Browse files
committed
Fix: RTRIM changes input string
1 parent 54f9823 commit d24529f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/common/blib_func.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,8 +1053,8 @@ void cmd_str1(long funcCode, var_t *arg, var_t *r) {
10531053
uint32_t len = strlen(arg->v.p.ptr);
10541054
if (*p != '\0') {
10551055
p = p + len - 1;
1056-
while (is_wspace(*p)) {
1057-
len--;
1056+
while (p >= arg->v.p.ptr && is_wspace(*p)) {
1057+
len--;
10581058
p--;
10591059
}
10601060
}

0 commit comments

Comments
 (0)