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

Previous Next

Package: emacs;

Reported by: Jim Meyering <jim <at> meyering.net>

Date: Sat, 28 Apr 2012 22:01:01 UTC

Severity: minor

Tags: patch

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11373 in the body.
You can then email your comments to 11373 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#11373; Package emacs. (Sat, 28 Apr 2012 22:01:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jim Meyering <jim <at> meyering.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 28 Apr 2012 22:01:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: bug-emacs <at> gnu.org
Subject: [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  <meyering <at> redhat.com>

	* 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  <meyering <at> redhat.com>
+
+	* xterm.c (x_term_init): Use memcpy in place of unwarranted strncpy.
+
 2012-04-24  Chong Yidong  <cyd <at> gnu.org>

 	* 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11373; Package emacs. (Wed, 02 May 2012 10:19:01 GMT) Full text and rfc822 format available.

Message #8 received at 11373 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: Jim Meyering <jim <at> meyering.net>
Cc: 11373 <at> debbugs.gnu.org
Subject: Re: bug#11373: [PATCH] xterm.c: Use memcpy in place of unwarranted
	strncpy.
Date: Wed, 02 May 2012 18:17:02 +0800
Jim Meyering <jim <at> meyering.net> writes:

> There's no reason to use strncpy here, and using it is misleading.
>
> 2012-04-28  Jim Meyering  <meyering <at> redhat.com>
>
> 	* xterm.c (x_term_init): Use memcpy in place of unwarranted strncpy.

Fine, committed to trunk.




bug closed, send any further explanations to 11373 <at> debbugs.gnu.org and Jim Meyering <jim <at> meyering.net> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 02 May 2012 10:19:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 30 May 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 305 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.