From 710ffd067bde55bffad72da5b052ff031a03a583 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 3 Jun 2008 23:51:39 +0000 Subject: [PATCH] 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. svn path=/trunk/; revision=25418 --- capture_ui_utils.c | 8 ++++++-- 1 file 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; } /*