Tidying: coverity issues
authorJeremy Harris <jgh146exb@wizmail.org>
Tue, 8 Nov 2016 23:40:09 +0000 (23:40 +0000)
committerJeremy Harris <jgh146exb@wizmail.org>
Sun, 13 Nov 2016 17:24:49 +0000 (17:24 +0000)
src/src/exim_dbmbuild.c
src/src/exim_lock.c
src/src/malware.c

index 611b6be38213eddc9f7732bbbb478a33b30d74df..85ae9012bc73ff1968be99b82843b02b30529d25 100644 (file)
@@ -480,7 +480,7 @@ else
   printf("dbmbuild abandoned\n");
 #if defined(USE_DB) || defined(USE_TDB) || defined(USE_GDBM)
   /* We created it, so safe to delete despite the name coming from outside */
   printf("dbmbuild abandoned\n");
 #if defined(USE_DB) || defined(USE_TDB) || defined(USE_GDBM)
   /* We created it, so safe to delete despite the name coming from outside */
-  /* coverity[tainted_data] */
+  /* coverity[tainted_string] */
   Uunlink(temp_dbmname);
 #else
   if (is_db)
   Uunlink(temp_dbmname);
 #else
   if (is_db)
index 074a951d1036b9c3b15a01bf8d49df833293391f..068216816054e832085d9cb035daa8ae50f12ba8 100644 (file)
@@ -588,12 +588,24 @@ if (restore_times)
   int fd = open(filename, O_RDWR); /* use fd for both get & restore */
   struct timespec tt[2];
 
   int fd = open(filename, O_RDWR); /* use fd for both get & restore */
   struct timespec tt[2];
 
-  fstat(fd, &strestore);
+  if (fd < 0)
+    {
+    printf("open '%s': %s\n", filename, strerror(errno));
+    yield = 1;
+    goto CLEAN_UP;
+    }
+  if (fstat(fd, &strestore) != 0)
+    {
+    printf("fstat '%s': %s\n", filename, strerror(errno));
+    yield = 1;
+    close(fd);
+    goto CLEAN_UP;
+    }
   i = system(command);
   tt[0] = strestore.st_atim;
   tt[1] = strestore.st_mtim;
   i = system(command);
   tt[0] = strestore.st_atim;
   tt[1] = strestore.st_mtim;
-  futimens(fd, tt);
-  close(fd);
+  (void) futimens(fd, tt);
+  (void) close(fd);
 #else
   struct utimbuf ut;
 
 #else
   struct utimbuf ut;
 
index b4a7f70948758687f35f4c2cd7adf35a50a9d0aa..b36bf0d6442e09cfc004b606936fc0ec67b8d956 100644 (file)
@@ -1003,7 +1003,9 @@ if (!malware_ok)
              kav_re = kav_re_inf;
              }
 
              kav_re = kav_re_inf;
              }
 
-           /* read report, linewise */
+           /* read report, linewise.  Using size from stream to read amount of data
+           from same stream is safe enough. */
+           /* coverity[tainted_data] */
            while (kav_reportlen > 0)
              {
              if ((bread = recv_line(sock, tmpbuf, sizeof(tmpbuf), tmo)) < 0)
            while (kav_reportlen > 0)
              {
              if ((bread = recv_line(sock, tmpbuf, sizeof(tmpbuf), tmo)) < 0)