static int dissect_mount_dirpath_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { char *mountpoint=NULL; if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){ rpc_call_info_value *civ=pinfo->private_data; if(civ->request && (civ->proc==1)){ const gchar *host; unsigned char *name; int len; unsigned char *ptr; host=ip_to_str(pinfo->dst.data); len=tvb_get_ntohl(tvb, offset); if (len >= ITEM_LABEL_LENGTH) THROW(ReportedBoundsError); name=g_malloc(strlen(host)+1+len+1+200); ptr=name; memcpy(ptr, host, strlen(host)); ptr+=strlen(host); *ptr++=':'; tvb_memcpy(tvb, ptr, offset+4, len); ptr+=len; *ptr=0; nfs_name_snoop_add_name(civ->xid, tvb, -1, (gint)strlen(name), 0, 0, name); } } offset = dissect_rpc_string(tvb,tree,hf_mount_path,offset,&mountpoint); if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO," %s", mountpoint); } return offset; }
static int dissect_mount_dirpath_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { const char *mountpoint=NULL; int offset = 0; if((!pinfo->fd->visited) && nfs_file_name_snooping){ rpc_call_info_value *civ=(rpc_call_info_value *)data; if(civ->request && (civ->proc==1)){ guint32 len_field; len_field = tvb_get_ntohl(tvb, offset); if (len_field < ITEM_LABEL_LENGTH) { gchar *name, *ptr; int addr_len, name_len; name = address_to_str(wmem_packet_scope(), &pinfo->dst); addr_len = (int)strlen(name); /* IP address, colon, path, terminating 0 */ name_len = addr_len + 1 + len_field + 1; name = (gchar *)wmem_realloc(wmem_packet_scope(), (void *)name, name_len); ptr = name + addr_len; *ptr++ = ':'; tvb_memcpy(tvb, ptr, offset+4, len_field); ptr += len_field; *ptr = 0; nfs_name_snoop_add_name(civ->xid, tvb, -1, name_len, 0, 0, name); } } } offset = dissect_rpc_string(tvb,tree,hf_mount_path,offset,&mountpoint); col_append_fstr(pinfo->cinfo, COL_INFO," %s", mountpoint); return offset; }