|
|
87e702 |
From a84f97f7dbeaf1ad0b3537c10e409dcf77baec52 Mon Sep 17 00:00:00 2001
|
|
|
87e702 |
From: "G. Branden Robinson" <g.branden.robinson@gmail.com>
|
|
|
87e702 |
Date: Sun, 23 May 2021 13:01:52 +1000
|
|
|
87e702 |
Subject: [PATCH 7/7] [grohtml]: Avoid deallocation of static strings.
|
|
|
87e702 |
|
|
|
87e702 |
* src/devices/grohtml/post-html.cpp (assert_state::add): Avoid potential
|
|
|
87e702 |
deallocation of statically-allocated strings. Use strsave() to
|
|
|
87e702 |
duplicate them so that they can be safely handed to a_delete(). Also
|
|
|
87e702 |
update diagnostic message to report name of complaining program
|
|
|
87e702 |
(continuing the long process of fixing Savannah #52463).
|
|
|
87e702 |
|
|
|
87e702 |
Fixes <https://savannah.gnu.org/bugs/index.php?60656>. Thanks to
|
|
|
87e702 |
Petru-Florin Mihancea for the report.
|
|
|
87e702 |
|
|
|
87e702 |
Also wrap source lines at 72 columns.
|
|
|
87e702 |
---
|
|
|
87e702 |
src/devices/grohtml/post-html.cpp | 9 +++++----
|
|
|
87e702 |
1 file changed, 5 insertions(+), 4 deletions(-)
|
|
|
87e702 |
|
|
|
87e702 |
diff --git a/src/devices/grohtml/post-html.cpp b/src/devices/grohtml/post-html.cpp
|
|
|
87e702 |
index 7bc017e..5218f92 100644
|
|
|
87e702 |
--- a/src/devices/grohtml/post-html.cpp
|
|
|
87e702 |
+++ b/src/devices/grohtml/post-html.cpp
|
|
|
87e702 |
@@ -1737,13 +1737,14 @@ void assert_state::add (assert_pos **h,
|
|
|
87e702 |
}
|
|
|
87e702 |
if (v == NULL || v[0] != '=') {
|
|
|
87e702 |
if (f == NULL)
|
|
|
87e702 |
- f = "stdin";
|
|
|
87e702 |
+ f = strsave("stdin");
|
|
|
87e702 |
if (l == NULL)
|
|
|
87e702 |
- l = "<none>";
|
|
|
87e702 |
+ l = strsave("<none>");
|
|
|
87e702 |
if (v == NULL)
|
|
|
87e702 |
v = "no value at all";
|
|
|
87e702 |
- fprintf(stderr, "%s:%s:error in assert format of id=%s expecting value to be prefixed with an '=' got %s\n",
|
|
|
87e702 |
- f, l, i, v);
|
|
|
87e702 |
+ fprintf(stderr, "%s:%s:%s:error in assert format of id=%s;"
|
|
|
87e702 |
+ " expecting value to be prefixed with an '=', got %s\n",
|
|
|
87e702 |
+ program_name, f, l, i, v);
|
|
|
87e702 |
}
|
|
|
87e702 |
t->id = i;
|
|
|
87e702 |
t->val = v;
|
|
|
87e702 |
--
|
|
|
87e702 |
2.32.0
|
|
|
87e702 |
|