]> git.eshelyaron.com Git - emacs.git/commitdiff
* src/xfns.c (x_window): Use xstrdup (Bug#11375).
authorJim Meyering <jim@meyering.net>
Wed, 2 May 2012 10:20:35 +0000 (18:20 +0800)
committerChong Yidong <cyd@gnu.org>
Wed, 2 May 2012 10:20:35 +0000 (18:20 +0800)
src/ChangeLog
src/xfns.c

index 33d95c6c7c68076e4fe0fa4a134e4d58c4a47b3d..d621dcc8859ad6f6f692c6128fa3c48ece66d4f9 100644 (file)
@@ -2,6 +2,8 @@
 
        * xterm.c (x_term_init): Use memcpy instead of strncpy (Bug#11373).
 
+       * xfns.c (x_window): Use xstrdup (Bug#11375).
+
 2012-05-02  Eli Zaretskii  <eliz@gnu.org>
 
        * xdisp.c (pos_visible_p): If already at a newline from the
index df1b39b018f73dde526986ac2e5713ade06f9d3b..510a66d634922660e911e07d8ef441726c68dbb1 100644 (file)
@@ -2439,7 +2439,6 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
 
   /* Do some needed geometry management.  */
   {
-    ptrdiff_t len;
     char *tem, shell_position[sizeof "=x++" + 4 * INT_STRLEN_BOUND (int)];
     Arg gal[10];
     int gac = 0;
@@ -2508,13 +2507,11 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
         }
     }
 
-    len = strlen (shell_position) + 1;
     /* We don't free this because we don't know whether
        it is safe to free it while the frame exists.
        It isn't worth the trouble of arranging to free it
        when the frame is deleted.  */
-    tem = (char *) xmalloc (len);
-    strncpy (tem, shell_position, len);
+    tem = (char *) xstrdup (shell_position);
     XtSetArg (gal[gac], XtNgeometry, tem); gac++;
     XtSetValues (shell_widget, gal, gac);
   }