diff --git a/lib/ftp.c b/lib/ftp.c index 3d116b543148650627f11abc20bddcd91107ae36..d940a12e0172c95934c5e865e9ded30e4abce8db 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -1393,7 +1393,8 @@ static CURLcode ftp_state_post_listtype(struct connectdata *conn) /* chop off the file part if format is dir/dir/file */ slashPos = strrchr(lstArg,'/'); - *(slashPos+1) = '\0'; + if(slashPos) + *(slashPos+1) = '\0'; } }