Using make 4.1.90 from the gnu git repoository with current HEAD commit ==
5bd7ad2b225bf9229ca96ba63b90f8094a2becde, the following diagnostic message
was received.

make: output.c:667: error: Assertion `fmtbuf.buffer[len-1] == '\0'' failed.

Investigation showed that in job.c, function child_error, the length of
string "nm" was not being included in the computed length value stored in
"l".  This resulted in the buffer overflow found by the assertion.

I suggest the patch below.  I have tested this and it works for me.

----------------------------------------------------------------
diff --git a/job.c b/job.c
index 62e2e56..40b7b0a 100644
--- a/job.c
+++ b/job.c
@@ -503,6 +503,7 @@ child_error (struct child *child,
       sprintf (a, "%s:%lu", flocp->filenm, flocp->lineno);
       nm = a;
     }
+  l += strlen (nm);
 
   OUTPUT_SET (&child->output);
 
----------------------------------------------------------------

_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to