aboutsummaryrefslogtreecommitdiffstats
path: root/capchild/capture_sync.c
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2016-09-06 09:58:48 +0200
committerPeter Wu <peter@lekensteyn.nl>2016-09-21 16:41:36 +0000
commit2e4024263622ed67b0dfd1d275ddab87549128cd (patch)
treee85c286e52bb5eab8b80984ab559ee86beeecf94 /capchild/capture_sync.c
parent4528da9f0112d7107b00de48ff71877b9be983bc (diff)
capture_sync: use ws_strtou function.
Change-Id: Ic128a7f1afd85f6b737392ff76b40d54cbdd8971 Reviewed-on: https://code.wireshark.org/review/17523 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'capchild/capture_sync.c')
-rw-r--r--capchild/capture_sync.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/capchild/capture_sync.c b/capchild/capture_sync.c
index 5c62e2c437..eb3a1e0531 100644
--- a/capchild/capture_sync.c
+++ b/capchild/capture_sync.c
@@ -31,6 +31,8 @@
#include <signal.h>
+#include <wsutil/strtoi.h>
+
#ifdef _WIN32
#include <wsutil/unicode-utils.h>
#include <wsutil/win32-utils.h>
@@ -1687,7 +1689,7 @@ sync_pipe_input_cb(gint source, gpointer user_data)
int secondary_len;
char *secondary_msg;
char *wait_msg, *combined_msg;
- int npackets;
+ guint32 npackets = 0;
nread = pipe_read_block(source, &indicator, SP_MAX_MSG_LEN, buffer,
&primary_msg);
@@ -1768,7 +1770,9 @@ sync_pipe_input_cb(gint source, gpointer user_data)
}
break;
case SP_PACKET_COUNT:
- npackets = atoi(buffer);
+ if (!ws_strtou32(buffer, NULL, &npackets)) {
+ g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_WARNING, "Invalid packets number: %s", buffer);
+ }
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "sync_pipe_input_cb: new packets %u", npackets);
cap_session->count += npackets;
capture_input_new_packets(cap_session, npackets);