aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-06-21 13:32:19 -0700
committerPaul Eggert2011-06-21 13:32:19 -0700
commit2606c57bbfd45c35357483e9fa39035ee8953cab (patch)
treed5e520e5bd29a7ba8ddd2cf5d9565921ebb203d4 /src
parent2674ddc8af7c6056f3113709c673773e4a3712b7 (diff)
downloademacs-2606c57bbfd45c35357483e9fa39035ee8953cab.tar.gz
emacs-2606c57bbfd45c35357483e9fa39035ee8953cab.zip
* xsmfns.c (smc_save_yourself_CB, x_session_initialize): Avoid strlen.
(x_session_initialize): Do not assume string length fits in int.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog3
-rw-r--r--src/xsmfns.c12
2 files changed, 9 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 1aafb12e07c..f0752ff8e0c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,8 @@
12011-06-21 Paul Eggert <eggert@cs.ucla.edu> 12011-06-21 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 * xsmfns.c (smc_save_yourself_CB, x_session_initialize): Avoid strlen.
4 (x_session_initialize): Do not assume string length fits in int.
5
3 * xsettings.c (apply_xft_settings): Fix potential buffer overrun. 6 * xsettings.c (apply_xft_settings): Fix potential buffer overrun.
4 This is unlikely, but can occur if DPI is outlandish. 7 This is unlikely, but can occur if DPI is outlandish.
5 8
diff --git a/src/xsmfns.c b/src/xsmfns.c
index c199036587f..cb56ae648d1 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -190,7 +190,7 @@ smc_save_yourself_CB (SmcConn smcConn,
190 props[props_idx]->type = xstrdup (SmARRAY8); 190 props[props_idx]->type = xstrdup (SmARRAY8);
191 props[props_idx]->num_vals = 1; 191 props[props_idx]->num_vals = 1;
192 props[props_idx]->vals = &values[val_idx++]; 192 props[props_idx]->vals = &values[val_idx++];
193 props[props_idx]->vals[0].length = strlen (SSDATA (Vinvocation_name)); 193 props[props_idx]->vals[0].length = SBYTES (Vinvocation_name);
194 props[props_idx]->vals[0].value = SDATA (Vinvocation_name); 194 props[props_idx]->vals[0].value = SDATA (Vinvocation_name);
195 ++props_idx; 195 ++props_idx;
196 196
@@ -200,7 +200,7 @@ smc_save_yourself_CB (SmcConn smcConn,
200 props[props_idx]->type = xstrdup (SmARRAY8); 200 props[props_idx]->type = xstrdup (SmARRAY8);
201 props[props_idx]->num_vals = 1; 201 props[props_idx]->num_vals = 1;
202 props[props_idx]->vals = &values[val_idx++]; 202 props[props_idx]->vals = &values[val_idx++];
203 props[props_idx]->vals[0].length = strlen (SSDATA (Vuser_login_name)); 203 props[props_idx]->vals[0].length = SBYTES (Vuser_login_name);
204 props[props_idx]->vals[0].value = SDATA (Vuser_login_name); 204 props[props_idx]->vals[0].value = SDATA (Vuser_login_name);
205 ++props_idx; 205 ++props_idx;
206 206
@@ -398,7 +398,7 @@ x_session_initialize (struct x_display_info *dpyinfo)
398 char errorstring[SM_ERRORSTRING_LEN]; 398 char errorstring[SM_ERRORSTRING_LEN];
399 char* previous_id = NULL; 399 char* previous_id = NULL;
400 SmcCallbacks callbacks; 400 SmcCallbacks callbacks;
401 int name_len = 0; 401 ptrdiff_t name_len = 0;
402 402
403 ice_fd = -1; 403 ice_fd = -1;
404 doing_interact = False; 404 doing_interact = False;
@@ -410,8 +410,8 @@ x_session_initialize (struct x_display_info *dpyinfo)
410 410
411 /* Construct the path to the Emacs program. */ 411 /* Construct the path to the Emacs program. */
412 if (! EQ (Vinvocation_directory, Qnil)) 412 if (! EQ (Vinvocation_directory, Qnil))
413 name_len += strlen (SSDATA (Vinvocation_directory)); 413 name_len += SBYTES (Vinvocation_directory);
414 name_len += strlen (SSDATA (Vinvocation_name)); 414 name_len += SBYTES (Vinvocation_name);
415 415
416 /* This malloc will not be freed, but it is only done once, and hopefully 416 /* This malloc will not be freed, but it is only done once, and hopefully
417 not very large */ 417 not very large */
@@ -457,7 +457,7 @@ x_session_initialize (struct x_display_info *dpyinfo)
457 457
458 if (smc_conn != 0) 458 if (smc_conn != 0)
459 { 459 {
460 Vx_session_id = make_string (client_id, strlen (client_id)); 460 Vx_session_id = build_string (client_id);
461 461
462#ifdef USE_GTK 462#ifdef USE_GTK
463 /* GTK creats a leader window by itself, but we need to tell 463 /* GTK creats a leader window by itself, but we need to tell