From: Harlan Stenn Date: Thu, 18 Jun 2009 07:54:37 +0000 (-0400) Subject: [Bug 1229] autokey segfaults in cert_install() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=613b5ab384942ac9c8f4c3165fc70ec9eaff5886;p=thirdparty%2Fntp.git [Bug 1229] autokey segfaults in cert_install() bk: 4a39f2bdOkqBaJuNOBq5q6TLc1Z9sw --- diff --git a/ChangeLog b/ChangeLog index e8a4ade80c..92ca4c40e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +* [Bug 1229] autokey segfaults in cert_install(). (4.2.5p181) 2009/06/06 Released by Harlan Stenn * [Bug 1206] Required compiler changes for Windows * [Bug 1084] PPSAPI for ntpd on Windows with DLL backends diff --git a/ntpd/ntp_crypto.c b/ntpd/ntp_crypto.c index 819eca85ea..fd33b7f14a 100644 --- a/ntpd/ntp_crypto.c +++ b/ntpd/ntp_crypto.c @@ -3060,7 +3060,7 @@ cert_install( struct peer *peer /* peer structure */ ) { - struct cert_info *cp, *xp, *yp, **zp; + struct cert_info *cp, *xp, **zp; /* * Parse and validate the signed certificate. If valid, @@ -3092,15 +3092,14 @@ cert_install( ntohl(xp->cert.fstamp)) { cert_free(cp); cp = xp; - break; + } else { + *zp = xp->link; + cert_free(xp); + xp = NULL; } - yp = xp; - xp = xp->link; - *zp = xp; - cert_free(yp); - } else { - zp = &xp->link; + break; } + zp = &xp->link; } if (xp == NULL) { cp->link = cinfo;