all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jim Meyering <jim@meyering.net>
To: 11373@debbugs.gnu.org
Subject: bug#11373: [PATCH] xterm.c: Use memcpy in place of unwarranted strncpy.
Date: Sat, 28 Apr 2012 23:58:35 +0200	[thread overview]
Message-ID: <87pqarmsc4.fsf@rho.meyering.net> (raw)

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

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





             reply	other threads:[~2012-04-28 21:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-28 21:58 Jim Meyering [this message]
2012-05-02 10:17 ` bug#11373: [PATCH] xterm.c: Use memcpy in place of unwarranted strncpy Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pqarmsc4.fsf@rho.meyering.net \
    --to=jim@meyering.net \
    --cc=11373@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.