diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2011-01-22 23:30:19 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2011-01-22 23:30:19 -0800 |
commit | 9055082ef8a2f1b9033f77f0eb2b9c756a306c01 (patch) | |
tree | 041665ff66c2bdab89f2f59976fb9ce0e2003ab0 /src/frame.c | |
parent | f77fabaf6bc1296631b1a4bcdf363721e19a3ac4 (diff) | |
download | emacs-9055082ef8a2f1b9033f77f0eb2b9c756a306c01.tar.gz |
Check return values of some library calls.
Diffstat (limited to 'src/frame.c')
-rw-r--r-- | src/frame.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/frame.c b/src/frame.c index 5cbdcf15abf..e663538a840 100644 --- a/src/frame.c +++ b/src/frame.c @@ -23,6 +23,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <ctype.h> +#include <errno.h> +#include <limits.h> #include <setjmp.h> #include "lisp.h" #include "character.h" @@ -2149,10 +2151,13 @@ frame_name_fnn_p (char *str, EMACS_INT len) if (len > 1 && str[0] == 'F') { char *end_ptr; + long int n; + errno = 0; + n = strtol (str + 1, &end_ptr, 10); - strtol (str + 1, &end_ptr, 10); - - if (end_ptr == str + len) + if (end_ptr == str + len + && INT_MIN <= n && n <= INT_MAX + && ((LONG_MIN < n && n < LONG_MAX) || errno != ERANGE)) return 1; } return 0; |