Blame SOURCES/diffutils-3.6-covscan.patch

8afaef
diff -up diffutils-3.6/lib/quotearg.c.covscan diffutils-3.6/lib/quotearg.c
8afaef
--- diffutils-3.6/lib/quotearg.c.covscan	2017-05-20 02:14:05.000000000 +0200
8afaef
+++ diffutils-3.6/lib/quotearg.c	2018-08-13 14:20:54.934196535 +0200
8afaef
@@ -886,8 +886,9 @@ quotearg_n_options (int n, char const *a
8afaef
   if (nslots <= n)
8afaef
     {
8afaef
       bool preallocated = (sv == &slotvec0);
8afaef
-
8afaef
-      if (MIN (INT_MAX, MIN (PTRDIFF_MAX, SIZE_MAX) / sizeof *sv) <= n)
8afaef
+      int nmax = MIN (INT_MAX, MIN (PTRDIFF_MAX, SIZE_MAX) / sizeof *sv) - 1;
8afaef
+      
8afaef
+      if (nmax < n)
8afaef
         xalloc_die ();
8afaef
 
8afaef
       slotvec = sv = xrealloc (preallocated ? NULL : sv, (n + 1) * sizeof *sv);
8afaef
diff -up diffutils-3.6/src/diff.h.covscan diffutils-3.6/src/diff.h
8afaef
--- diffutils-3.6/src/diff.h.covscan	2018-08-13 14:20:54.931196520 +0200
8afaef
+++ diffutils-3.6/src/diff.h	2018-08-13 14:20:54.935196541 +0200
8afaef
@@ -392,7 +392,7 @@ extern void print_sdiff_script (struct c
8afaef
 extern char const change_letter[4];
8afaef
 extern char const pr_program[];
8afaef
 extern char *concat (char const *, char const *, char const *);
8afaef
-extern bool (*lines_differ) (char const *, size_t, char const *, size_t) _GL_ATTRIBUTE_PURE;
8afaef
+extern bool (*lines_differ) (char const *, size_t, char const *, size_t);
8afaef
 extern bool lines_differ_singlebyte (char const *, size_t, char const *, size_t) _GL_ATTRIBUTE_PURE;
8afaef
 #ifdef HANDLE_MULTIBYTE
8afaef
 extern bool lines_differ_multibyte (char const *, size_t, char const *, size_t) _GL_ATTRIBUTE_PURE;
8afaef
diff -up diffutils-3.6/src/ifdef.c.covscan diffutils-3.6/src/ifdef.c
8afaef
--- diffutils-3.6/src/ifdef.c.covscan	2017-05-18 19:39:59.000000000 +0200
8afaef
+++ diffutils-3.6/src/ifdef.c	2018-08-13 14:20:54.935196541 +0200
8afaef
@@ -362,20 +362,14 @@ do_printf_spec (FILE *out, char const *s
8afaef
 	    printint print_value = value;
8afaef
 	    size_t spec_prefix_len = f - spec - 2;
8afaef
 	    size_t pI_len = sizeof pI - 1;
8afaef
-#if 0
8afaef
-	    char format[spec_prefix_len + pI_len + 2];
8afaef
-#else
8afaef
 	    char *format = xmalloc (spec_prefix_len + pI_len + 2);
8afaef
-#endif
8afaef
 	    char *p = format + spec_prefix_len + pI_len;
8afaef
 	    memcpy (format, spec, spec_prefix_len);
8afaef
 	    memcpy (format + spec_prefix_len, pI, pI_len);
8afaef
 	    *p++ = c;
8afaef
 	    *p = '\0';
8afaef
 	    fprintf (out, format, print_value);
8afaef
-#if ! HAVE_C_VARARRAYS
8afaef
 	    free (format);
8afaef
-#endif
8afaef
 	  }
8afaef
       }
8afaef
       break;
8afaef
diff -up diffutils-3.6/src/sdiff.c.covscan diffutils-3.6/src/sdiff.c
8afaef
--- diffutils-3.6/src/sdiff.c.covscan	2018-08-13 14:41:13.969450849 +0200
8afaef
+++ diffutils-3.6/src/sdiff.c	2018-08-13 14:44:07.877344103 +0200
8afaef
@@ -230,8 +230,10 @@ cleanup (int signo __attribute__((unused
8afaef
   if (0 < diffpid)
8afaef
     kill (diffpid, SIGPIPE);
8afaef
 #endif
8afaef
-  if (tmpname)
8afaef
+  if (tmpname) {
8afaef
     unlink (tmpname);
8afaef
+    free (tmpname);
8afaef
+  }
8afaef
 }
8afaef
 
8afaef
 static void exiterr (void) __attribute__((noreturn));
8afaef
@@ -685,6 +687,7 @@ main (int argc, char *argv[])
8afaef
 	if (tmpname)
8afaef
 	  {
8afaef
 	    unlink (tmpname);
8afaef
+	    free (tmpname);
8afaef
 	    tmpname = 0;
8afaef
 	  }
8afaef