]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
refclock_acts.c:
authorFrank Kardel <kardel@ntp.org>
Sat, 24 Jun 2006 17:39:54 +0000 (17:39 +0000)
committerFrank Kardel <kardel@ntp.org>
Sat, 24 Jun 2006 17:39:54 +0000 (17:39 +0000)
  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

ntpd/ntp_util.c
ntpd/refclock_acts.c
ntpd/refclock_parse.c
ntpq/ntpq.c

index 5c0cea470f7b6651d54324eddbc1751a55316537..6befcaf39205d99a3774dbc0d2468e6ab92de552 100644 (file)
@@ -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);
index 9558b09977e540353721e46b4eed94e5e05cf9c8..7c372686a4ca7c58560ad9d827fa29ce2c9ebf00 100644 (file)
@@ -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;
                        }
index 0ea4d652e39537174c0b0c990b0a2374c66c806c..5809b96aadeee1f8af6aa7225346f92c037e4665 100644 (file)
@@ -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
  *
index 05b5bf50e9f68b2bb934f86e555d8ba264752097..14bb43c843ecf5702352087829d7cb51b8b324c7 100644 (file)
@@ -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 = ", ";