]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/plugins/passprompt.c
pppd: Fix `ifname` option in case of multilink (#105)
[ppp.git] / pppd / plugins / passprompt.c
index 768901718e884d6654265817ee9c3ced1e2118e7..babb6dc31bab6f1d71d1cabedfd844ba2a4d5158 100644 (file)
@@ -50,7 +50,7 @@ static int promptpass(char *user, char *passwd)
     }
     if (!kid) {
        /* we are the child, exec the program */
-       char *argv[4], fdstr[32];
+       char *argv[5], fdstr[32];
        sys_close();
        closelog();
        close(p[0]);
@@ -82,7 +82,6 @@ static int promptpass(char *user, char *passwd)
        }
        readgood += red;
     } while (readgood < MAXSECRETLEN - 1);
-    passwd[readgood] = 0;
     close(p[0]);
 
     /* now wait for child to exit */
@@ -95,6 +94,7 @@ static int promptpass(char *user, char *passwd)
 
     if (readgood < 0)
        return 0;
+    passwd[readgood] = 0;
     if (!WIFEXITED(wstat))
        warn("%s terminated abnormally", promptprog);
     if (WEXITSTATUS(wstat))