comparison src/frame.c @ 112441:2097405cdc11

Merge: Check return values of some library calls.
author Paul Eggert <eggert@cs.ucla.edu>
date Sat, 22 Jan 2011 23:32:08 -0800
parents b5017c649dfb
children
comparison
equal deleted inserted replaced
112439:5610f272341f 112441:2097405cdc11
21 21
22 #include <config.h> 22 #include <config.h>
23 23
24 #include <stdio.h> 24 #include <stdio.h>
25 #include <ctype.h> 25 #include <ctype.h>
26 #include <errno.h>
27 #include <limits.h>
26 #include <setjmp.h> 28 #include <setjmp.h>
27 #include "lisp.h" 29 #include "lisp.h"
28 #include "character.h" 30 #include "character.h"
29 #ifdef HAVE_X_WINDOWS 31 #ifdef HAVE_X_WINDOWS
30 #include "xterm.h" 32 #include "xterm.h"
2147 frame_name_fnn_p (char *str, EMACS_INT len) 2149 frame_name_fnn_p (char *str, EMACS_INT len)
2148 { 2150 {
2149 if (len > 1 && str[0] == 'F') 2151 if (len > 1 && str[0] == 'F')
2150 { 2152 {
2151 char *end_ptr; 2153 char *end_ptr;
2152 2154 long int n;
2153 strtol (str + 1, &end_ptr, 10); 2155 errno = 0;
2154 2156 n = strtol (str + 1, &end_ptr, 10);
2155 if (end_ptr == str + len) 2157
2158 if (end_ptr == str + len
2159 && INT_MIN <= n && n <= INT_MAX
2160 && ((LONG_MIN < n && n < LONG_MAX) || errno != ERANGE))
2156 return 1; 2161 return 1;
2157 } 2162 }
2158 return 0; 2163 return 0;
2159 } 2164 }
2160 2165