From: Ralph Corderoy Date: Sat, 22 Oct 2016 17:09:02 +0000 (+0100) Subject: Fix netrc's token()'s bug if backslash escapes EOF. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/d850c88b75c333607ef22e50ffced3914297a4b8?ds=sidebyside Fix netrc's token()'s bug if backslash escapes EOF. Discard the whole token so the user hopefully investigates. --- diff --git a/sbr/ruserpass.c b/sbr/ruserpass.c index 5b650389..f5fc6bd8 100644 --- a/sbr/ruserpass.c +++ b/sbr/ruserpass.c @@ -204,8 +204,9 @@ token(char *tokval) return TOK_EOF; while ((c = getc(cfile)) != EOF && c && !strchr(stop, c)) { - if (c == '\\') - c = getc(cfile); /* BUG: What if this is EOF. */ + if (c == '\\' && (c = getc(cfile)) == EOF) + return TOK_EOF; /* Discard whole token. */ + *cp++ = c; if (cp - tokval > MAX_TOKVAL_SIZE-1) { adios(NULL, "credential tokens restricted to length %d",