summaryrefslogtreecommitdiff
path: root/extcap/androiddump.c
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2016-08-31 10:14:33 +0200
committerDario Lombardo <lomato@gmail.com>2016-09-16 14:21:16 +0000
commitd67c1db3f2b16185d7cff250e098f48d94883f0e (patch)
treef111269e33ea8b0ac29532c18e2ce16762f4f515 /extcap/androiddump.c
parent2492fe41ba165738aa8667ebfe7f9e96f69ef350 (diff)
downloadwireshark-d67c1db3f2b16185d7cff250e098f48d94883f0e.tar.gz
extcap: make extcap use the ws_strtoi/u functions.
Change-Id: Id75c72eba869c8a0f413ce8b5d6329ce172aed1f Reviewed-on: https://code.wireshark.org/review/17415 Petri-Dish: Dario Lombardo <lomato@gmail.com> Reviewed-by: Roland Knall <rknall@gmail.com> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Dario Lombardo <lomato@gmail.com>
Diffstat (limited to 'extcap/androiddump.c')
-rw-r--r--extcap/androiddump.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/extcap/androiddump.c b/extcap/androiddump.c
index 896142d31b..b92c1705fc 100644
--- a/extcap/androiddump.c
+++ b/extcap/androiddump.c
@@ -30,6 +30,7 @@
#include <string.h>
#include <errno.h>
#include <time.h>
+#include <wsutil/strtoi.h>
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
@@ -438,7 +439,7 @@ static socket_handle_t adb_connect(const char *server_ip, unsigned short *server
static char *adb_send_and_receive(socket_handle_t sock, const char *adb_service,
char *buffer, int buffer_length, gssize *data_length) {
gssize used_buffer_length;
- gssize length;
+ gint32 length;
gssize result;
char status[4];
char tmp_buffer;
@@ -2587,7 +2588,10 @@ int main(int argc, char **argv) {
g_warning("Impossible exception. Parameter required argument, but there is no it right now.");
goto end;
}
- *adb_server_tcp_port = (unsigned short) g_ascii_strtoull(optarg, NULL, 10);
+ if (!ws_strtou16(optarg, NULL, adb_server_tcp_port)) {
+ g_warning("Invalid adb server TCP port: %s", optarg);
+ goto end;
+ }
break;
case OPT_CONFIG_LOGCAT_TEXT:
logcat_text = (g_ascii_strncasecmp(optarg, "TRUE", 4) == 0);
@@ -2598,7 +2602,10 @@ int main(int argc, char **argv) {
g_warning("Impossible exception. Parameter required argument, but there is no it right now.");
goto end;
}
- *bt_server_tcp_port = (unsigned short) g_ascii_strtoull(optarg, NULL, 10);
+ if (!ws_strtou16(optarg, NULL, bt_server_tcp_port)) {
+ g_warning("Invalid bluetooth server TCP port: %s", optarg);
+ goto end;
+ }
break;
case OPT_CONFIG_BT_FORWARD_SOCKET:
bt_forward_socket = (g_ascii_strncasecmp(optarg, "TRUE", 4) == 0);
@@ -2612,7 +2619,10 @@ int main(int argc, char **argv) {
g_warning("Impossible exception. Parameter required argument, but there is no it right now.");
goto end;
}
- *bt_local_tcp_port = (unsigned short) g_ascii_strtoull(optarg, NULL, 10);
+ if (!ws_strtou16(optarg, NULL, bt_local_tcp_port)) {
+ g_warning("Invalid bluetooth local tcp port: %s", optarg);
+ goto end;
+ }
break;
default:
if (!extcap_base_parse_options(extcap_conf, result - EXTCAP_OPT_LIST_INTERFACES, optarg))