]> diplodocus.org Git - nmh/commitdiff
Fix ruserpass() to not assume `\n' present before trimming.
authorRalph Corderoy <ralph@inputplus.co.uk>
Wed, 19 Oct 2016 15:34:05 +0000 (16:34 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Wed, 19 Oct 2016 16:30:14 +0000 (17:30 +0100)
sbr/ruserpass.c

index bc24f52..de0f951 100644 (file)
@@ -148,7 +148,7 @@ ruserpass(char *host, char **aname, char **apass)
        if (fgets(tmp, sizeof(tmp) - 1, stdin) == NULL) {
            advise ("tmp", "fgets");
        }
-       tmp[strlen(tmp) - 1] = '\0';
+        TrimSuffixC(tmp, '\n');
        if (*tmp != '\0' || myname == NULL) {
            myname = tmp;
        }