Ethereal-dev: Re: [Ethereal-dev] NFS file name snooping problem?

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Pia Sahlberg" <piabar@xxxxxxxxxxx>
Date: Sat, 13 Apr 2002 16:01:09 +0000
Hi list, hi Uwe

I can not create a proper patch since i am internet disadvantaged right now
but please try to replace the function dissect_mount_dirpath_call
in packet-mount.c with teh following instead:

static int
dissect_mount_dirpath_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
	if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){
		rpc_call_info_value *civ=pinfo->private_data;

		if(civ->request && (civ->proc==1)){
			unsigned char *host, *dir, *name;
			int len;

			host=ip_to_str(pinfo->dst.data);
			len=tvb_get_ntohl(tvb, offset);

			dir=tvb_get_ptr(tvb, offset+4, len);
			if(dir){
				unsigned char *ptr;
				name=g_malloc(strlen(host)+1+len+1+200);
				ptr=name;
				memcpy(ptr, host, strlen(host));
				ptr+=strlen(host);
				*ptr++=':';
				memcpy(ptr, dir, len);
				ptr+=len;
				*ptr=0;
				nfs_name_snoop_add_name(civ->xid, tvb, -1, strlen(name), 0, 0, name);
			}
		}
	}

	if ( tree )
	{
		offset = dissect_rpc_string(tvb,pinfo,tree,hf_mount_path,offset,NULL);
	}

	return offset;
}


sorry for the weird formatting. hotmail does not offer me an attach-file thingy anymore it seems.


This stops it from dumping core on the capture you sent to the list.
The sprintf() thingy failed to properly null terminate the string thus
causing damage.


best regards
	ronnie sahlberg



_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. http://www.hotmail.com