[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 01/12: [grohtml]: Avoid deallocation of static strings.
From: |
G. Branden Robinson |
Subject: |
[groff] 01/12: [grohtml]: Avoid deallocation of static strings. |
Date: |
Mon, 24 May 2021 13:06:11 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit 7dcb6263dcb3edcf373fff0a6e1f62242d18950e
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sun May 23 13:01:52 2021 +1000
[grohtml]: Avoid deallocation of static strings.
* src/devices/grohtml/post-html.cpp (assert_state::add): Avoid potential
deallocation of statically-allocated strings. Use strsave() to
duplicate them so that they can be safely handed to a_delete(). Also
update diagnostic message to report name of complaining program
(continuing the long process of fixing Savannah #52463).
Fixes <https://savannah.gnu.org/bugs/index.php?60656>. Thanks to
Petru-Florin Mihancea for the report.
Also wrap source lines at 72 columns.
---
ChangeLog | 12 ++++++++++++
src/devices/grohtml/post-html.cpp | 9 +++++----
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9618e02..758baf6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2021-05-23 G. Branden Robinson <g.branden.robinson@gmail.com>
+ * src/devices/grohtml/post-html.cpp (assert_state::add): Avoid
+ potential deallocation of statically-allocated strings. Use
+ strsave() to duplicate them so that they can be safely handed to
+ a_delete(). Also update diagnostic message to report name of
+ complaining program (continuing the long process of fixing
+ Savannah #52463).
+
+ Fixes <https://savannah.gnu.org/bugs/index.php?60656>. Thanks
+ to Petru-Florin Mihancea for the report.
+
+2021-05-23 G. Branden Robinson <g.branden.robinson@gmail.com>
+
* tmac/troffrc-end: Fix transposition error that broke most
table image generation in HTML output.
diff --git a/src/devices/grohtml/post-html.cpp
b/src/devices/grohtml/post-html.cpp
index e451342..d3a6cf4 100644
--- a/src/devices/grohtml/post-html.cpp
+++ b/src/devices/grohtml/post-html.cpp
@@ -1738,13 +1738,14 @@ void assert_state::add (assert_pos **h,
}
if (v == NULL || v[0] != '=') {
if (f == NULL)
- f = "stdin";
+ f = strsave("stdin");
if (l == NULL)
- l = "<none>";
+ l = strsave("<none>");
if (v == NULL)
v = "no value at all";
- fprintf(stderr, "%s:%s:error in assert format of id=%s expecting value
to be prefixed with an '=' got %s\n",
- f, l, i, v);
+ fprintf(stderr, "%s:%s:%s:error in assert format of id=%s;"
+ " expecting value to be prefixed with an '=', got %s\n",
+ program_name, f, l, i, v);
}
t->id = i;
t->val = v;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 01/12: [grohtml]: Avoid deallocation of static strings.,
G. Branden Robinson <=