aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-02-07 00:49:31 +0100
committerGerald Combs <gerald@wireshark.org>2015-02-07 02:16:06 +0000
commit2c65b33b2169a1a40766d55f8eb6339e7b412794 (patch)
tree1f681d0deeea15ad7008267a15fc31110f6e103a
parent6f22eb6f7f2ba3034a1f5b2155d70f7c22eb9c68 (diff)
Fix RTP crash on RTP analysis attempt
The tap listener was handling rtpstream_tapinfo_t* types while other users was expecting a GList* instead. Fix this and avoid future confusion by replacing void* pointers. Ping-Bug: 10714 Change-Id: I66f62eaaed4a529714264bbf4e7ad1e72b46ce5a Reviewed-on: https://code.wireshark.org/review/6997 Reviewed-by: Gerald Combs <gerald@wireshark.org>
-rw-r--r--ui/gtk/rtp_stream_dlg.c24
-rw-r--r--ui/qt/rtp_stream_dialog.cpp4
-rw-r--r--ui/qt/rtp_stream_dialog.h2
-rw-r--r--ui/rtp_stream.c2
-rw-r--r--ui/rtp_stream.h3
5 files changed, 17 insertions, 18 deletions
diff --git a/ui/gtk/rtp_stream_dlg.c b/ui/gtk/rtp_stream_dlg.c
index 51eeba18b7..75b64e4a15 100644
--- a/ui/gtk/rtp_stream_dlg.c
+++ b/ui/gtk/rtp_stream_dlg.c
@@ -51,14 +51,14 @@ static const gchar FWD_LABEL_TEXT[] = "Select a forward stream with left mouse b
static const gchar FWD_ONLY_LABEL_TEXT[] = "Select a forward stream with Ctrl + left mouse button";
static const gchar REV_LABEL_TEXT[] = "Select a reverse stream with Ctrl + left mouse button";
-static void rtpstream_dlg_update(void *ti_ptr);
+static void rtpstream_tap_draw(rtpstream_tapinfo_t *ti_ptr);
static void rtpstream_dlg_mark_packet(rtpstream_tapinfo_t *tapinfo, frame_data *fd);
void register_tap_listener_rtp_stream_dlg(void);
/* The one and only global rtpstream_tapinfo_t structure for tshark and wireshark.
*/
static rtpstream_tapinfo_t the_tapinfo_struct =
- { rtpstream_dlg_update, rtpstream_dlg_mark_packet, NULL, 0, NULL, 0,
+ { rtpstream_tap_draw, rtpstream_dlg_mark_packet, NULL, 0, NULL, 0,
TAP_ANALYSE, NULL, NULL, NULL, 0, FALSE
};
@@ -1085,17 +1085,8 @@ rtpstream_dlg_create (void)
/* update the contents of the dialog box list_store */
/* list: pointer to list of rtp_stream_info_t* */
static void
-rtpstream_dlg_update(void *ti_ptr)
+rtpstream_dlg_update(GList *list_lcl)
{
- GList *list_lcl;
- rtpstream_tapinfo_t *tapinfo = (rtpstream_tapinfo_t *)ti_ptr;
-
- if (!tapinfo) {
- return;
- }
-
- list_lcl = tapinfo->strinfo_list;
-
if (rtp_stream_dlg != NULL) {
gtk_list_store_clear(list_store);
streams_nb = 0;
@@ -1114,6 +1105,15 @@ rtpstream_dlg_update(void *ti_ptr)
}
static void
+rtpstream_tap_draw(rtpstream_tapinfo_t *tapinfo)
+{
+ if (tapinfo) {
+ rtpstream_dlg_update(tapinfo->strinfo_list);
+ }
+}
+
+
+static void
rtpstream_dlg_mark_packet(rtpstream_tapinfo_t *tapinfo _U_, frame_data *fd) {
if (!fd) return;
diff --git a/ui/qt/rtp_stream_dialog.cpp b/ui/qt/rtp_stream_dialog.cpp
index a361355405..dd26c2a5fb 100644
--- a/ui/qt/rtp_stream_dialog.cpp
+++ b/ui/qt/rtp_stream_dialog.cpp
@@ -315,10 +315,8 @@ bool RtpStreamDialog::eventFilter(QObject *obj, QEvent *event)
return false;
}
-void RtpStreamDialog::tapDraw(void *tapinfo_ptr)
+void RtpStreamDialog::tapDraw(rtpstream_tapinfo_t *tapinfo)
{
- rtpstream_tapinfo_t *tapinfo = (rtpstream_tapinfo_t *) tapinfo_ptr;
-
RtpStreamDialog *rtp_stream_dialog = static_cast<RtpStreamDialog *>(tapinfo->tap_data);
if (rtp_stream_dialog) {
rtp_stream_dialog->updateStreams();
diff --git a/ui/qt/rtp_stream_dialog.h b/ui/qt/rtp_stream_dialog.h
index 1615d5453e..b45af313fa 100644
--- a/ui/qt/rtp_stream_dialog.h
+++ b/ui/qt/rtp_stream_dialog.h
@@ -63,7 +63,7 @@ private:
QMenu ctx_menu_;
bool need_redraw_;
- static void tapDraw(void *tapinfo_ptr);
+ static void tapDraw(rtpstream_tapinfo_t *tapinfo);
static void tapMarkPacket(rtpstream_tapinfo_t *tapinfo, frame_data *fd);
void updateStreams();
diff --git a/ui/rtp_stream.c b/ui/rtp_stream.c
index f188d0bd5b..11f41c15a5 100644
--- a/ui/rtp_stream.c
+++ b/ui/rtp_stream.c
@@ -56,7 +56,7 @@ static void rtpstream_draw(void *ti_ptr)
g_signal_emit_by_name(top_level, "signal_rtpstream_update");
*/
if (tapinfo && tapinfo->tap_draw) {
- tapinfo->tap_draw(ti_ptr);
+ tapinfo->tap_draw(tapinfo);
}
return;
}
diff --git a/ui/rtp_stream.h b/ui/rtp_stream.h
index d8ceaaf1e6..9c9b57c070 100644
--- a/ui/rtp_stream.h
+++ b/ui/rtp_stream.h
@@ -106,12 +106,13 @@ typedef enum
typedef struct _rtpstream_tapinfo rtpstream_tapinfo_t;
+typedef void (*rtpstream_tap_draw_cb)(rtpstream_tapinfo_t *tapinfo);
typedef void (*tap_mark_packet_cb)(rtpstream_tapinfo_t *tapinfo, frame_data *fd);
/* structure that holds the information about all detected streams */
/** struct holding all information of the tap */
struct _rtpstream_tapinfo {
- tap_draw_cb tap_draw; /**< tap draw callback */
+ rtpstream_tap_draw_cb tap_draw; /**< tap draw callback */
tap_mark_packet_cb tap_mark_packet; /**< packet marking callback */
void *tap_data; /**< data for tap callbacks */
int nstreams; /**< number of streams in the list */