[PATCH 7/8] split: don't rely on knowledge that INT_BUFSIZE_BOUND <= SIG
From:
Jim Meyering
Subject:
[PATCH 7/8] split: don't rely on knowledge that INT_BUFSIZE_BOUND <= SIG2STR_MAX
Date:
Sat, 30 Apr 2011 15:31:08 +0200
From: Jim Meyering <address@hidden>
* src/split.c (closeout): SIG2STR_MAX is a buffer size, so there's
no need to add 1. However, since we may also write the decimal
representation of an "int" into this same buffer, include
INT_BUFSIZE_BOUND in the equation.
---
src/split.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/split.c b/src/split.c
index bd63fcf..66f44fc 100644
--- a/src/split.c
+++ b/src/split.c
@@ -372,7 +372,7 @@ closeout (FILE *fp, int fd, pid_t pid, char const *name)
int sig = WTERMSIG (wstatus);
if (sig != SIGPIPE)
{
- char signame[SIG2STR_MAX+1];
+ char signame[MAX (SIG2STR_MAX, INT_BUFSIZE_BOUND (int))];
if (sig2str (sig, signame) != 0)
sprintf (signame, "%d", sig);
error (sig + 128, 0,
--
1.7.5.134.g1c08b