diff --git a/src/ls.c b/src/ls.c index 63a74a1..ba7d0db 100644 --- a/src/ls.c +++ b/src/ls.c @@ -1051,8 +1051,8 @@ void domlsd(const char *base) if (*base != 0 && chdir(base) != 0) { if (*base++ == '-') { - while (!isspace((unsigned char) *base++)); - while (isspace((unsigned char) *base++)); + while (*base!=0 && !isspace((unsigned char) *base++)); + while (*base!=0 && isspace((unsigned char) *base++)); if (*base != 0 && chdir(base) != 0) { addreply_noformat(550, MSG_STAT_FAILURE2); return;