gbranden pushed a commit to branch master
in repository groff.
commit 4b3c10b03fdf72527ad0c6fa8b18d6b623ed4ae1
Author: Lukas Javorsky <[email protected]>
AuthorDate: Mon Aug 12 13:02:35 2024 +0200
[gxditview]: Fix Savannah #66076.
* src/devices/xditview/xditview.c (NewFile): Populate
`current_file_name` with `name` more cautiously since the latter
originates in the `argv` array.
Fixes <https://savannah.gnu.org/bugs/?66076>.
---
ChangeLog | 8 ++++++++
src/devices/xditview/xditview.c | 3 ++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 974c732e6..c88aea9c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-08-12 Lukas Javorsky <[email protected]>
+
+ * src/devices/xditview/xditview.c (NewFile): Populate
+ `current_file_name` with `name` more cautiously since the latter
+ originates in the `argv` array.
+
+ Fixes <https://savannah.gnu.org/bugs/?66076>.
+
2024-08-14 Lukas Javorsky <[email protected]>
* src/preproc/refer/ref.cpp (same_reference): Fix array
diff --git a/src/devices/xditview/xditview.c b/src/devices/xditview/xditview.c
index 2be55230b..d8bd8cabd 100644
--- a/src/devices/xditview/xditview.c
+++ b/src/devices/xditview/xditview.c
@@ -367,7 +367,8 @@ NewFile (const char *name)
}
hadFile = 1;
SelectPageNumber ("1");
- strcpy (current_file_name, name);
+ strncpy(current_file_name, name, sizeof(current_file_name) - 1);
+ current_file_name[sizeof(current_file_name) - 1] = '\0'; // Ensure
null-termination
current_file = new_file;
}
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit