diff options
author | Peter Valchev <pvalchev@cvs.openbsd.org> | 2003-09-26 06:01:43 +0000 |
---|---|---|
committer | Peter Valchev <pvalchev@cvs.openbsd.org> | 2003-09-26 06:01:43 +0000 |
commit | 35ad2f35226d93d8529515f531dee25d01a17280 (patch) | |
tree | 559da7af7e7804fcfa094ff55044cdd4fcc196a3 /usr.sbin/pppd | |
parent | b271c2cc29581f93e70d10ce2b71d94b6fb660c8 (diff) |
realloc fixes; ok deraadt millert
Diffstat (limited to 'usr.sbin/pppd')
-rw-r--r-- | usr.sbin/pppd/auth.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/usr.sbin/pppd/auth.c b/usr.sbin/pppd/auth.c index b00dcaa79e0..f303847e2f4 100644 --- a/usr.sbin/pppd/auth.c +++ b/usr.sbin/pppd/auth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auth.c,v 1.29 2003/04/16 07:44:04 tedu Exp $ */ +/* $OpenBSD: auth.c,v 1.30 2003/09/26 06:01:42 pvalchev Exp $ */ /* * auth.c - PPP authentication and phase control. @@ -77,7 +77,7 @@ #if 0 static char rcsid[] = "Id: auth.c,v 1.37 1998/03/26 04:46:03 paulus Exp $"; #else -static char rcsid[] = "$OpenBSD: auth.c,v 1.29 2003/04/16 07:44:04 tedu Exp $"; +static char rcsid[] = "$OpenBSD: auth.c,v 1.30 2003/09/26 06:01:42 pvalchev Exp $"; #endif #endif @@ -765,10 +765,16 @@ static int pam_conv (int num_msg, for (count = 0; count < num_msg; count++) { - size += sizeof (struct pam_response); - reply = realloc (reply, size); /* ANSI: is malloc() if reply==NULL */ - if (!reply) + struct pam_response *newreply; + int newsize = size + sizeof (struct pam_response); + newreply = realloc (reply, newsize); /* ANSI: is malloc() if reply==NULL */ + if (!newreply) { + free(reply); + reply = NULL; return PAM_CONV_ERR; + } + reply = newreply; + size = newsize; switch (msg[count]->msg_style) { |