Further small fix to regerror() overflow handling, to ensure identical output
whether or not there is a zero at the end of the buffer.
This commit is contained in:
parent
371bf87af6
commit
21ca32717f
|
@ -4780,7 +4780,11 @@ if ((pat_patctl.control & CTL_POSIX) != 0)
|
||||||
memcpy(pbuffer8 + bsize, "DEADBEEF", 8);
|
memcpy(pbuffer8 + bsize, "DEADBEEF", 8);
|
||||||
usize = regerror(rc, &preg, (char *)pbuffer8, bsize);
|
usize = regerror(rc, &preg, (char *)pbuffer8, bsize);
|
||||||
|
|
||||||
psize = (int)bsize;
|
/* Inside regerror(), snprintf() is used. If the buffer is too small, some
|
||||||
|
versions of snprintf() put a zero byte at the end, but others do not.
|
||||||
|
Therefore, we print a maximum of one less than the size of the buffer. */
|
||||||
|
|
||||||
|
psize = (int)bsize - 1;
|
||||||
fprintf(outfile, "Failed: POSIX code %d: %.*s\n", rc, psize, pbuffer8);
|
fprintf(outfile, "Failed: POSIX code %d: %.*s\n", rc, psize, pbuffer8);
|
||||||
if (usize > bsize)
|
if (usize > bsize)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue