groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 09/10: [gxditview]: Fix Savannah #66076.


From: G. Branden Robinson
Subject: [groff] 09/10: [gxditview]: Fix Savannah #66076.
Date: Thu, 17 Oct 2024 20:39:43 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 4b3c10b03fdf72527ad0c6fa8b18d6b623ed4ae1
Author: Lukas Javorsky <ljavorsk@redhat.com>
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 <ljavorsk@redhat.com>
+
+       * 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 <ljavorsk@redhat.com>
 
        * 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;
 }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]