diff options
author | Dario Lombardo <lomato@gmail.com> | 2018-03-10 19:23:17 +0100 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2018-03-11 02:08:28 +0000 |
commit | 2a9097046e51d67794780bb57e94229e769fc01b (patch) | |
tree | 17b04d898fc3d86a493eaa9c684b6edb9d5bff0b /epan/maxmind_db.c | |
parent | ab7fbb73951716ee08406fc1a51fc522da2c420d (diff) |
maxmind: use ws_strtou32 to convert AS numbers.
Change-Id: I0578f8a674feee6e4763d5481a2285b7b2a054dc
Reviewed-on: https://code.wireshark.org/review/26416
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'epan/maxmind_db.c')
-rw-r--r-- | epan/maxmind_db.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/epan/maxmind_db.c b/epan/maxmind_db.c index 93b5a15ce0..484be7f355 100644 --- a/epan/maxmind_db.c +++ b/epan/maxmind_db.c @@ -33,6 +33,7 @@ static mmdb_lookup_t mmdb_not_found; #include <wsutil/file_util.h> #include <wsutil/filesystem.h> #include <wsutil/ws_pipe.h> +#include <wsutil/strtoi.h> // To do: // - If we can't reliably do non-blocking reads, move process_mmdbr_stdout to a worker thread. @@ -174,9 +175,12 @@ process_mmdbr_stdout(void) { } else if (g_str_has_prefix(line, RES_ASN_ORG)) { cur_lookup.found = TRUE; cur_lookup.as_org = chunkify_string(val_start); - } else if (g_str_has_prefix(line, RES_ASN_NUMBER)) { - cur_lookup.found = TRUE; - cur_lookup.as_number = (unsigned int) strtoul(val_start, NULL, 10); + } else if (val_start && g_str_has_prefix(line, RES_ASN_NUMBER)) { + if (ws_strtou32(val_start, NULL, &cur_lookup.as_number)) { + cur_lookup.found = TRUE; + } else { + MMDB_DEBUG("Invalid as number: %s", val_start); + } } else if (g_str_has_prefix(line, RES_LOCATION_LATITUDE)) { cur_lookup.found = TRUE; cur_lookup.latitude = g_ascii_strtod(val_start, NULL); |