diff options
author | Peter Wu <peter@lekensteyn.nl> | 2017-01-25 15:35:09 +0100 |
---|---|---|
committer | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2017-01-27 02:41:00 +0000 |
commit | 9f600384e8c113c43a069d491a7482c402c1ea8d (patch) | |
tree | 94e88cb8653e3c5b0e27abb7c32b85620b448406 /sharkd_session.c | |
parent | 69c29d77cf9d4b4b852f0ecabc8a0b67b2954c33 (diff) |
sharkd: fix potential division-by-zero issue
The interval parameter is user-supplied and is used as divisor.
Change-Id: I9cbbecb71da3991c1712cb87e93de072cc950224
Reviewed-on: https://code.wireshark.org/review/19787
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jakub Zawadzki <darkjames-ws@darkjames.pl>
Diffstat (limited to 'sharkd_session.c')
-rw-r--r-- | sharkd_session.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sharkd_session.c b/sharkd_session.c index e6d0c4b740..2903d83108 100644 --- a/sharkd_session.c +++ b/sharkd_session.c @@ -1338,8 +1338,12 @@ sharkd_session_process_intervals(char *buf, const jsmntok_t *tokens, int count) gint64 idx; gint64 max_idx = 0; - if (tok_interval) - (void) ws_strtou32(tok_interval, NULL, &interval_ms); + if (tok_interval) { + if (!ws_strtou32(tok_interval, NULL, &interval_ms) || interval_ms == 0) { + fprintf(stderr, "Invalid interval parameter: %s.\n", tok_interval); + return; + } + } if (tok_filter) { |