#985426 aux.c: calculate the size of NBUF to accommodate two arrays and a string

Package:
src:nn
Source:
nn
Submitter:
Bjarni Ingi Gislason
Date:
2021-03-18 04:06:03 UTC
Severity:
normal
Tags:
#985426#5
Date:
2021-03-18 04:02:11 UTC
From:
To:
Dear Maintainer,

  The compiler issues warnings about the needed length in several uses
of "snprintf()".

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
---
 aux.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/aux.c b/aux.c
index f5c3a87..72f3b6f 100644
--- a/aux.c
+++ b/aux.c
@@ -298,7 +298,9 @@ aux_sh(article_header * ah, char *script, char *prog, char *action, char *record
     char            route[512], *poster = NULL;
     int             goodsigntype = 0;
     int             loop = 1, prmpt = 0;
-#define NBUF  80
+/* 53 is the length of the string "awk ..." in the line number about 589 */
+/* NBUF = sizeof(bdy) + sizeof(sgn) + 53 + strlen(NUL) */
+#define NBUF  2 * FILENAME + 54
 #define NBUF2 10
     char            cc[256], pr[80], pr1[80], fname[FILENAME], buf[NBUF];
     char            buf2[NBUF2];