aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-04-18 16:32:38 -0700
committerPaul Eggert2011-04-18 16:32:38 -0700
commit5e073ec7384c432e42a8affeeb6d6906588f2af9 (patch)
tree0f36f403e54e206165f1893f3139a2c22c42025d /src
parentd0f4e1f5ac162d9c32381c65a0bc7b456e189826 (diff)
downloademacs-5e073ec7384c432e42a8affeeb6d6906588f2af9.tar.gz
emacs-5e073ec7384c432e42a8affeeb6d6906588f2af9.zip
* frame.c (frame_name_fnn_p): Get rid of strtol, which isn't right
here, since it parses constructs like leading '-' and spaces, which are not wanted; and it overflows with large numbers. Instead, simply match F[0-9]+, which is what is wanted anyway.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/frame.c15
2 files changed, 11 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 3ca41d7b51b..42c7d06168f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
12011-04-18 Paul Eggert <eggert@cs.ucla.edu> 12011-04-18 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 * frame.c (frame_name_fnn_p): Get rid of strtol, which isn't right
4 here, since it parses constructs like leading '-' and spaces,
5 which are not wanted; and it overflows with large numbers.
6 Instead, simply match F[0-9]+, which is what is wanted anyway.
7
3 * alloc.c: Remove unportable assumptions about struct layout. 8 * alloc.c: Remove unportable assumptions about struct layout.
4 (SDATA_SELECTOR, SDATA_DATA_OFFSET): New macros. 9 (SDATA_SELECTOR, SDATA_DATA_OFFSET): New macros.
5 (SDATA_OF_STRING, SDATA_SIZE, allocate_string_data): 10 (SDATA_OF_STRING, SDATA_SIZE, allocate_string_data):
diff --git a/src/frame.c b/src/frame.c
index 9024a2fb5e2..179ae4019dc 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -2154,18 +2154,15 @@ store_in_alist (Lisp_Object *alistptr, Lisp_Object prop, Lisp_Object val)
2154static int 2154static int
2155frame_name_fnn_p (char *str, EMACS_INT len) 2155frame_name_fnn_p (char *str, EMACS_INT len)
2156{ 2156{
2157 if (len > 1 && str[0] == 'F') 2157 if (len > 1 && str[0] == 'F' && '0' <= str[1] && str[1] <= '9')
2158 { 2158 {
2159 char *end_ptr; 2159 char *p = str + 2;
2160 long int n; 2160 while ('0' <= *p && *p <= '9')
2161 errno = 0; 2161 p++;
2162 n = strtol (str + 1, &end_ptr, 10); 2162 if (p == str + len)
2163
2164 if (end_ptr == str + len
2165 && INT_MIN <= n && n <= INT_MAX
2166 && ((LONG_MIN < n && n < LONG_MAX) || errno != ERANGE))
2167 return 1; 2163 return 1;
2168 } 2164 }
2165
2169 return 0; 2166 return 0;
2170} 2167}
2171 2168