Ethereal-dev: [ethereal-dev] NCP over IP header proccessing change in packet-ncp

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

From: James Coe <jammer@xxxxxxx>
Date: Tue, 14 Dec 1999 20:23:51 -0600
The attached patch changes the NCP over IP header processing to use
element = pntohl(&pd[offset]) instead of memcopy since the byte order of
every element had to be fixed anyway and the header is small.

Jamie Coe.


Index: packet-ncp.c
===================================================================
RCS file: /cvsroot/ethereal/packet-ncp.c,v
retrieving revision 1.26
diff -u -r1.26 packet-ncp.c
--- packet-ncp.c	1999/12/14 21:57:03	1.26
+++ packet-ncp.c	1999/12/15 02:19:47
@@ -548,16 +548,16 @@
 	struct ncp_common_header	header;
 
 	if ( pi.ptype == PT_TCP || pi.ptype == PT_UDP ) {
-		memcpy(&ncpiph, &pd[offset], sizeof(ncpiph));
-		ncpiph.signature = ntohl(ncpiph.signature);
-		ncpiph.length = ntohl(ncpiph.length);
+		ncpiph.signature = pntohl(&pd[offset]);
+		ncpiph.length = pntohl(&pd[offset + 4]);
 		offset += 8;
 		if ( ncpiph.signature == NCPIP_RQST ) {
-			memcpy(&ncpiphrq, &pd[offset], sizeof(ncpiphrq));
-			ncpiphrq.rplybufsize = ntohl(ncpiphrq.rplybufsize);
+			ncpiphrq.version = pntohl(&pd[offset]);
+			ncpiphrq.rplybufsize = pntohl(&pd[offset + 4]);
 			offset += 8;
 		};
 	};
+
 	memcpy(&header, &pd[offset], sizeof(header));
 	header.type = ntohs(header.type);