bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#11373: [PATCH] xterm.c: Use memcpy in place of unwarranted strncpy.


From: Jim Meyering
Subject: bug#11373: [PATCH] xterm.c: Use memcpy in place of unwarranted strncpy.
Date: Sat, 28 Apr 2012 23:58:35 +0200

There's no reason to use strncpy here, and using it is misleading.

2012-04-28  Jim Meyering  <address@hidden>

        * xterm.c (x_term_init): Use memcpy in place of unwarranted strncpy.

---
 src/ChangeLog |    4 ++++
 src/xterm.c   |    2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 2792901..6ec58f9 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2012-04-26  Jim Meyering  <address@hidden>
+
+       * xterm.c (x_term_init): Use memcpy in place of unwarranted strncpy.
+
 2012-04-24  Chong Yidong  <address@hidden>

        * xselect.c (x_convert_selection): Initialize a pointer (Bug#11315).
diff --git a/src/xterm.c b/src/xterm.c
index 9ce1668..2922b05 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10146,7 +10146,7 @@ x_term_init (Lisp_Object display_name, char 
*xrm_option, char *resource_name)

   /* Set the name of the terminal. */
   terminal->name = (char *) xmalloc (SBYTES (display_name) + 1);
-  strncpy (terminal->name, SSDATA (display_name), SBYTES (display_name));
+  memcpy (terminal->name, SSDATA (display_name), SBYTES (display_name));
   terminal->name[SBYTES (display_name)] = 0;

 #if 0
--
1.7.10.382.g62bc8





reply via email to

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