From: simon Date: Wed, 22 Aug 2012 18:36:44 +0000 (+0000) Subject: Fix a bug in the PSFTP command parser which would cause it to X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/commitdiff_plain/5ab93329d5698739fcf00d3d52d69c8936ecd3f4 Fix a bug in the PSFTP command parser which would cause it to hallucinate an extra empty argument word at the end of a line if the line ended in more than one whitespace character. git-svn-id: svn://svn.tartarus.org/sgt/putty@9613 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/psftp.c b/psftp.c index 482d66ee..ef930bdd 100644 --- a/psftp.c +++ b/psftp.c @@ -2287,10 +2287,13 @@ struct sftp_command *sftp_getcmd(FILE *fp, int mode, int modeflags) * >this has "quotes" in< * >and"this"< */ - while (*p) { + while (1) { /* skip whitespace */ while (*p && (*p == ' ' || *p == '\t')) p++; + /* terminate loop */ + if (!*p) + break; /* mark start of word */ q = r = p; /* q sits at start, r writes word */ quoting = 0;