diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2008-06-03 23:51:39 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2008-06-03 23:51:39 +0000 |
commit | c6870020950e04ab02dfaa05bf1c816d0c27e0e7 (patch) | |
tree | 0cc258d80eacf00068f01a1da80361207ba47136 /capture_ui_utils.c | |
parent | 439f66126a2192f7124bf393fcb97827529cf281 (diff) |
strtol() returns a long, as the name suggests; assign its return value
to a long, and check whether it fits in a gint before returning it as a
gint.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@25418 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'capture_ui_utils.c')
-rw-r--r-- | capture_ui_utils.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/capture_ui_utils.c b/capture_ui_utils.c index 738d5ccd5f..551b78947c 100644 --- a/capture_ui_utils.c +++ b/capture_ui_utils.c @@ -101,7 +101,7 @@ gint capture_dev_user_linktype_find(const gchar *if_name) { gchar *p, *next; - gint linktype; + long linktype; if (prefs.capture_devices_linktypes == NULL) { /* There are no link-layer header types */ @@ -119,8 +119,12 @@ capture_dev_user_linktype_find(const gchar *if_name) /* Syntax error */ return -1; } + if (linktype > G_MAXINT) { + /* Value doesn't fit in a gint */ + return -1; + } - return linktype; + return (gint)linktype; } /* |