From: Paul Mackerras Date: Sun, 3 Feb 2013 10:44:11 +0000 (+1100) Subject: plugins/passprompt: Fix potential out-of-bounds array reference X-Git-Tag: ppp-2.4.7~27 X-Git-Url: http://git.ozlabs.org/?a=commitdiff_plain;h=8edb889b753056a691a3e4b217a110a35f9fdedb;hp=9e05a25d76b3f83096c661678010320df673df6b;p=ppp.git plugins/passprompt: Fix potential out-of-bounds array reference From Debian BTS, fix suggested by Timo Weingärtner. Signed-off-by: Paul Mackerras --- diff --git a/pppd/plugins/passprompt.c b/pppd/plugins/passprompt.c index 1d885fc..babb6dc 100644 --- a/pppd/plugins/passprompt.c +++ b/pppd/plugins/passprompt.c @@ -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))