gbranden pushed a commit to branch master
in repository groff.

commit 455ebad6a56da9f704d7e1f8f99134b542de4ae8
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Nov 20 15:11:26 2026 -0600

    [tbl]: Zero out a char buffer before reusing it.
    
    * src/preproc/tbl/main.cpp (describe_character): Zero the static buffer
      contents so that garbage can't accumulate in it.  Since the string
      written there is always null-terminated, failing to do so _shouldn't_
      ever be a problem, but it's a relatively cheap operation that happens
      only on an error path.
---
 ChangeLog                | 8 ++++++++
 src/preproc/tbl/main.cpp | 1 +
 2 files changed, 9 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 57b7db001..7afdc7193 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2026-11-20  G. Branden Robinson <[email protected]>
+
+       * src/preproc/tbl/main.cpp (describe_character): Zero the
+       static buffer contents so that garbage can't accumulate in it.
+       Since the string written there is always null-terminated,
+       failing to do so _shouldn't_ ever be a problem, but it's a
+       relatively cheap operation that happens only on an error path.
+
 2026-11-16  G. Branden Robinson <[email protected]>
 
        [pic]: Boolify AT&T compatibility flag.
diff --git a/src/preproc/tbl/main.cpp b/src/preproc/tbl/main.cpp
index 0951342f7..9712f0521 100644
--- a/src/preproc/tbl/main.cpp
+++ b/src/preproc/tbl/main.cpp
@@ -806,6 +806,7 @@ static const char *describe_character(int c)
   const size_t descbufsize = strlen(cc) + 1 /* ' ' */ + INT_DIGITS
                             + 1 /* '\0' */;
   static char descbuf[descbufsize];
+  (void) memset(descbuf, 0, (descbufsize * sizeof(char)));
   if (csprint(c)) {
     char quote = '\'';
     if ('\'' == c)

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to