From: Frank Kardel Date: Sat, 24 Jun 2006 17:39:54 +0000 (+0000) Subject: refclock_acts.c: X-Git-Tag: NTP_4_2_2P0_RC5~1^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e284dde1f9baab85660a7ee12d343b146960d8b2;p=thirdparty%2Fntp.git refclock_acts.c: NetBSD Coverity CID 3797: bad return code check for open(2) fixed (!fd replaced with fd < 0) ntp_util.c: NetBSD Coverity CID 3804: avoid file pointer leak refclock_parse.c: NetBSD Coverity CID 3796: possible NULL deref ntpq.c: NetBSD Coverity CID 3799: overrun static array (off by one) fixed bk: 449d78eaimKESw_upT0z95hhofZBIw --- diff --git a/ntpd/ntp_util.c b/ntpd/ntp_util.c index 5c0cea470..6befcaf39 100644 --- a/ntpd/ntp_util.c +++ b/ntpd/ntp_util.c @@ -341,6 +341,7 @@ stats_config( msyslog(LOG_ERR, "Frequency format error in %s", stats_drift_file); old_drift = 1e9; + fclose(fp); break; } fclose(fp); diff --git a/ntpd/refclock_acts.c b/ntpd/refclock_acts.c index 9558b0997..7c372686a 100644 --- a/ntpd/refclock_acts.c +++ b/ntpd/refclock_acts.c @@ -754,7 +754,7 @@ acts_timeout( sprintf(lockfile, LOCKFILE, up->unit); fd = open(lockfile, O_WRONLY | O_CREAT | O_EXCL, 0644); - if (!fd) { + if (fd < 0) { msyslog(LOG_ERR, "acts: port busy"); return; } diff --git a/ntpd/refclock_parse.c b/ntpd/refclock_parse.c index 0ea4d652e..5809b96aa 100644 --- a/ntpd/refclock_parse.c +++ b/ntpd/refclock_parse.c @@ -4887,7 +4887,8 @@ trimbletsip_setup( return 1; /* not yet */ } - t->last_reset = current_time; + if (t) + t->last_reset = current_time; buf.txt = buffer; @@ -5684,6 +5685,9 @@ int refclock_parse_bs; * History: * * refclock_parse.c,v + * Revision 4.74 2006/06/18 21:18:37 kardel + * NetBSD Coverity CID 3796: possible NULL deref + * * Revision 4.73 2006/05/26 14:23:46 kardel * cleanup of copyright info * diff --git a/ntpq/ntpq.c b/ntpq/ntpq.c index 05b5bf50e..14bb43c84 100644 --- a/ntpq/ntpq.c +++ b/ntpq/ntpq.c @@ -2984,7 +2984,7 @@ tstflags( cb += strlen(cb); } else { *cb++ = ' '; - for (i = 0; i < 14; i++) { + for (i = 0; i < 13; i++) { if (val & 0x1) { sprintf(cb, "%s%s", sep, tstflagnames[i]); sep = ", ";