Allow the tvbuff pointer to various "proto_tree_add" routines to be null
if (and only if) the length of the item being added is 0 (so that it has no data backing it). This means the data stream name pointer for the item in question is null; make sure we handle that. Use that for some "uses the value from the matching request" fields in the SMB Pipe protocol. svn path=/trunk/; revision=4231
This commit is contained in:
parent
3c11e4ff6d
commit
8550cfcc6f
17
epan/proto.c
17
epan/proto.c
|
@ -1,7 +1,7 @@
|
|||
/* proto.c
|
||||
* Routines for protocol tree
|
||||
*
|
||||
* $Id: proto.c,v 1.42 2001/11/15 10:58:51 guy Exp $
|
||||
* $Id: proto.c,v 1.43 2001/11/20 09:07:32 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -1504,6 +1504,12 @@ alloc_field_info(int hfindex, tvbuff_t *tvb, gint start, gint length)
|
|||
fi = g_mem_chunk_alloc(gmc_field_info);
|
||||
|
||||
g_assert(hfindex >= 0 && (guint) hfindex < gpa_hfinfo->len);
|
||||
|
||||
/*
|
||||
* We only allow a null tvbuff if the item has a zero length,
|
||||
* i.e. if there's no data backing it.
|
||||
*/
|
||||
g_assert(tvb != NULL || length == 0);
|
||||
fi->hfinfo = proto_registrar_get_nth(hfindex);
|
||||
g_assert(fi->hfinfo != NULL);
|
||||
fi->start = start;
|
||||
|
@ -1518,7 +1524,11 @@ alloc_field_info(int hfindex, tvbuff_t *tvb, gint start, gint length)
|
|||
fi->value = fvalue_new(fi->hfinfo->type);
|
||||
|
||||
/* add the data source name */
|
||||
fi->ds_name = tvb_get_name(tvb);
|
||||
if (tvb) {
|
||||
fi->ds_name = tvb_get_name(tvb);
|
||||
} else {
|
||||
fi->ds_name = NULL;
|
||||
}
|
||||
|
||||
return fi;
|
||||
}
|
||||
|
@ -2780,7 +2790,8 @@ check_for_offset(GNode *node, gpointer data)
|
|||
offset_search_t *offsearch = data;
|
||||
|
||||
/* !fi == the top most container node which holds nothing */
|
||||
if (fi && fi->visible && !strcmp( offsearch->name,fi->ds_name)) {
|
||||
if (fi && fi->visible && fi->ds_name &&
|
||||
strcmp(offsearch->name, fi->ds_name) == 0) {
|
||||
if (offsearch->offset >= (guint) fi->start &&
|
||||
offsearch->offset < (guint) (fi->start + fi->length)) {
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* main.c
|
||||
*
|
||||
* $Id: main.c,v 1.210 2001/11/09 07:44:50 guy Exp $
|
||||
* $Id: main.c,v 1.211 2001/11/20 09:07:33 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -475,7 +475,8 @@ tree_view_select_row_cb(GtkCTree *ctree, GList *node, gint column, gpointer user
|
|||
finfo = gtk_ctree_node_get_row_data( ctree, GTK_CTREE_NODE(node) );
|
||||
if (!finfo) return;
|
||||
|
||||
set_notebook_page( byte_nb_ptr, find_notebook_page( byte_nb_ptr, finfo->ds_name));
|
||||
if (finfo->ds_name != NULL)
|
||||
set_notebook_page( byte_nb_ptr, find_notebook_page( byte_nb_ptr, finfo->ds_name));
|
||||
|
||||
byte_view = gtk_object_get_data(GTK_OBJECT(byte_nb_ptr), E_BYTE_VIEW_TEXT_INFO_KEY);
|
||||
byte_data = gtk_object_get_data(GTK_OBJECT(byte_view), E_BYTE_VIEW_DATA_PTR_KEY);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
|
||||
*
|
||||
* $Id: packet_win.c,v 1.22 2001/08/21 06:39:18 guy Exp $
|
||||
* $Id: packet_win.c,v 1.23 2001/11/20 09:07:34 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -234,9 +234,11 @@ new_tree_view_select_row_cb(GtkCTree *ctree, GList *node, gint column,
|
|||
finfo = gtk_ctree_node_get_row_data( ctree, GTK_CTREE_NODE(node) );
|
||||
if (!finfo) return;
|
||||
|
||||
i = find_notebook_page( DataPtr->bv_nb_ptr, finfo->ds_name);
|
||||
set_notebook_page ( DataPtr->bv_nb_ptr, i);
|
||||
len = get_byte_view_and_data( DataPtr->bv_nb_ptr, &byte_view, &data);
|
||||
if (finfo->ds_name != NULL) {
|
||||
i = find_notebook_page( DataPtr->bv_nb_ptr, finfo->ds_name);
|
||||
set_notebook_page ( DataPtr->bv_nb_ptr, i);
|
||||
}
|
||||
len = get_byte_view_and_data( DataPtr->bv_nb_ptr, &byte_view, &data);
|
||||
|
||||
if ( !byte_view) /* exit if no hex window to write in */
|
||||
return;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* proto_draw.c
|
||||
* Routines for GTK+ packet display
|
||||
*
|
||||
* $Id: proto_draw.c,v 1.38 2001/08/31 19:47:10 guy Exp $
|
||||
* $Id: proto_draw.c,v 1.39 2001/11/20 09:07:34 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -905,14 +905,22 @@ proto_tree_draw_node(GNode *node, gpointer data)
|
|||
gchar *label_ptr;
|
||||
GtkCTreeNode *parent;
|
||||
gboolean is_leaf, is_expanded;
|
||||
int i;
|
||||
int i;
|
||||
|
||||
if (!fi->visible)
|
||||
return;
|
||||
i= find_notebook_page( byte_nb_ptr, fi->ds_name);
|
||||
if ( i < 0)
|
||||
return; /* no notebook pages ?? */
|
||||
set_notebook_page( byte_nb_ptr, i);
|
||||
/*
|
||||
* XXX - why are we doing this? This is done when we consruct
|
||||
* the protocol tree display, but, as far as I can tell, it only
|
||||
* needs to be done when a particular field in the tree is
|
||||
* selected.
|
||||
*/
|
||||
if (fi->ds_name != NULL) {
|
||||
i = find_notebook_page(byte_nb_ptr, fi->ds_name);
|
||||
if (i < 0)
|
||||
return; /* no notebook pages ?? */
|
||||
set_notebook_page(byte_nb_ptr, i);
|
||||
}
|
||||
|
||||
/* was a free format label produced? */
|
||||
if (fi->representation) {
|
||||
|
|
|
@ -8,7 +8,7 @@ XXX Fixme : shouldnt show [malformed frame] for long packets
|
|||
* significant rewrite to tvbuffify the dissector, Ronnie Sahlberg and
|
||||
* Guy Harris 2001
|
||||
*
|
||||
* $Id: packet-smb-pipe.c,v 1.50 2001/11/20 07:47:41 guy Exp $
|
||||
* $Id: packet-smb-pipe.c,v 1.51 2001/11/20 09:07:31 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -2716,7 +2716,7 @@ dissect_pipe_smb(tvbuff_t *sp_tvb, tvbuff_t *s_tvb, tvbuff_t *pd_tvb,
|
|||
*/
|
||||
if (tri != NULL && tri->function != -1) {
|
||||
function = tri->function;
|
||||
proto_tree_add_uint(pipe_tree, hf_pipe_function, sp_tvb,
|
||||
proto_tree_add_uint(pipe_tree, hf_pipe_function, NULL,
|
||||
0, 0, function);
|
||||
if (check_col(pinfo->fd, COL_INFO)) {
|
||||
col_add_fstr(pinfo->fd, COL_INFO, "%s %s",
|
||||
|
@ -2725,7 +2725,7 @@ dissect_pipe_smb(tvbuff_t *sp_tvb, tvbuff_t *s_tvb, tvbuff_t *pd_tvb,
|
|||
}
|
||||
fid = tri->fid;
|
||||
if (fid != -1)
|
||||
add_fid(sp_tvb, pinfo, pipe_tree, 0, 0, fid);
|
||||
add_fid(NULL, pinfo, pipe_tree, 0, 0, fid);
|
||||
} else {
|
||||
function = -1;
|
||||
fid = -1;
|
||||
|
|
Loading…
Reference in New Issue