[prev in list] [next in list] [prev in thread] [next in thread] 

List:       snort-cvs
Subject:    [snort-cvs] CVS: snort sp_icmp_code_check.c,1.1.1.1,1.2 sp_icmp_id_check.c,1.1.1.1,1.2 sp_icmp_seq_c
From:       Fyodor Yarochkin <fygrave () users ! sourceforge ! net>
Date:       2000-12-06 1:57:29
[Download RAW message or body]

Update of /cvsroot/snort/snort
In directory slayer.i.sourceforge.net:/tmp/cvs-serv13192

Modified Files:
	sp_icmp_code_check.c sp_icmp_id_check.c sp_icmp_seq_check.c 
	sp_icmp_type_check.c sp_ip_id_check.c sp_ip_tos_check.c 
	sp_ipoption_check.c sp_rpc_check.c sp_tcp_ack_check.c 
	sp_tcp_flag_check.c sp_tcp_seq_check.c sp_ttl_check.c 
Log Message:
Let me make some commits before I go to bed at 9:00 am in the morning ;-)
Added checks for null pointers in protocol headers where apropriate. 


Index: sp_icmp_code_check.c
===================================================================
RCS file: /cvsroot/snort/snort/sp_icmp_code_check.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** sp_icmp_code_check.c	2000/08/07 02:42:18	1.1.1.1
--- sp_icmp_code_check.c	2000/12/06 01:57:25	1.2
***************
*** 145,148 ****
--- 145,152 ----
  int IcmpCodeCheck(Packet *p, struct _OptTreeNode *otn, OptFpList *fp_list)
  {
+     if (!p->icmph)
+ 	    return 0; /* if error occured while icmp header
+ 	               * was processed, return 0 automagically.
+ 		       */
      if (((IcmpCodeCheckData *) otn->ds_list[PLUGIN_ICMP_CODE])->icmp_code == p->icmph->code)
      {

Index: sp_icmp_id_check.c
===================================================================
RCS file: /cvsroot/snort/snort/sp_icmp_id_check.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** sp_icmp_id_check.c	2000/08/07 02:42:19	1.1.1.1
--- sp_icmp_id_check.c	2000/12/06 01:57:25	1.2
***************
*** 157,160 ****
--- 157,164 ----
  int IcmpIdCheck(Packet *p, struct _OptTreeNode *otn, OptFpList *fp_list)
  {
+     if (!p->icmph)
+ 	    return 0; /* if error occured while icmp header
+ 	               * was processed, return 0 automagically.
+ 		       */
      if (p->icmph->type == ICMP_ECHO || p->icmph->type == ICMP_ECHOREPLY)
      {

Index: sp_icmp_seq_check.c
===================================================================
RCS file: /cvsroot/snort/snort/sp_icmp_seq_check.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** sp_icmp_seq_check.c	2000/08/07 02:42:19	1.1.1.1
--- sp_icmp_seq_check.c	2000/12/06 01:57:25	1.2
***************
*** 156,159 ****
--- 156,163 ----
  int IcmpSeqCheck(Packet *p, struct _OptTreeNode *otn, OptFpList *fp_list)
  {
+     if (!p->icmph)
+ 	    return 0; /* if error occured while icmp header
+ 	               * was processed, return 0 automagically.
+ 		       */
      if (p->icmph->type == ICMP_ECHO || p->icmph->type == ICMP_ECHOREPLY)
      {

Index: sp_icmp_type_check.c
===================================================================
RCS file: /cvsroot/snort/snort/sp_icmp_type_check.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** sp_icmp_type_check.c	2000/08/07 02:42:19	1.1.1.1
--- sp_icmp_type_check.c	2000/12/06 01:57:25	1.2
***************
*** 145,148 ****
--- 145,152 ----
  int IcmpTypeCheck(Packet *p, struct _OptTreeNode *otn, OptFpList *fp_list)
  {
+     if (!p->icmph)
+ 	    return 0; /* if error occured while icmp header
+ 	               * was processed, return 0 automagically.
+ 		       */
      if (((IcmpTypeCheckData *) otn->ds_list[PLUGIN_ICMP_TYPE])->icmp_type == p->icmph->type)
      {

Index: sp_ip_id_check.c
===================================================================
RCS file: /cvsroot/snort/snort/sp_ip_id_check.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** sp_ip_id_check.c	2000/08/07 02:42:19	1.1.1.1
--- sp_ip_id_check.c	2000/12/06 01:57:25	1.2
***************
*** 131,134 ****
--- 131,138 ----
  int IpIdCheckEq(Packet *p, struct _OptTreeNode *otn, OptFpList *fp_list)
  {
+     if (!p->iph)
+ 	    return 0; /* if error occured while ip header
+ 	               * was processed, return 0 automagically.
+ 		       */
      if (((IpIdData *)otn->ds_list[PLUGIN_IP_ID_CHECK])->ip_id == ntohs(p->iph->ip_id))
      {

Index: sp_ip_tos_check.c
===================================================================
RCS file: /cvsroot/snort/snort/sp_ip_tos_check.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** sp_ip_tos_check.c	2000/08/30 20:07:49	1.2
--- sp_ip_tos_check.c	2000/12/06 01:57:25	1.3
***************
*** 131,134 ****
--- 131,138 ----
  int IpTosCheckEq(Packet *p, struct _OptTreeNode *otn, OptFpList *fp_list)
  {
+     if (!p->iph)
+ 	    return 0; /* if error occured while ip header
+ 	               * was processed, return 0 automagically.
+ 		       */
      if (((IpTosData *)otn->ds_list[PLUGIN_IP_TOS_CHECK])->ip_tos == ntohs(p->iph->ip_tos))
      {

Index: sp_ipoption_check.c
===================================================================
RCS file: /cvsroot/snort/snort/sp_ipoption_check.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** sp_ipoption_check.c	2000/11/06 23:23:43	1.3
--- sp_ipoption_check.c	2000/12/06 01:57:25	1.4
***************
*** 192,195 ****
--- 192,199 ----
      printf("CheckIpOptions:");
  #endif
+     if (!p->iph)
+ 	    return 0; /* if error occured while ip header
+ 	               * was processed, return 0 automagically.
+ 		       */
  
      if((((IpOptionData *)otn->ds_list[PLUGIN_IPOPTION_CHECK])->any_flag == 1) 

Index: sp_rpc_check.c
===================================================================
RCS file: /cvsroot/snort/snort/sp_rpc_check.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** sp_rpc_check.c	2000/08/07 02:42:24	1.1.1.1
--- sp_rpc_check.c	2000/12/06 01:57:25	1.2
***************
*** 160,163 ****
--- 160,168 ----
      int i;
  #endif
+     if (!p->iph || (p->iph->ip_proto == IPPROTO_TCP && !p->tcph)
+ 	        || (p->iph->ip_proto == IPPROTO_UDP && !p->udph))
+ 	    return 0; /* if error occured while ip header
+ 	               * was processed, return 0 automagically.
+ 		       */
  
      if (p->iph->ip_proto == IPPROTO_TCP)

Index: sp_tcp_ack_check.c
===================================================================
RCS file: /cvsroot/snort/snort/sp_tcp_ack_check.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** sp_tcp_ack_check.c	2000/08/07 02:42:25	1.1.1.1
--- sp_tcp_ack_check.c	2000/12/06 01:57:25	1.2
***************
*** 134,137 ****
--- 134,140 ----
  int CheckTcpAckEq(Packet *p, struct _OptTreeNode *otn, OptFpList *fp_list)
  {
+     if (!p->tcph)
+ 	   return 0; /* if error appeared when tcp header was processed,
+ 	   	      * test fails automagically */
      if (((TcpAckCheckData *)otn->ds_list[PLUGIN_TCP_ACK_CHECK])->tcp_ack == ntohl(p->tcph->th_ack))
      {

Index: sp_tcp_flag_check.c
===================================================================
RCS file: /cvsroot/snort/snort/sp_tcp_flag_check.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** sp_tcp_flag_check.c	2000/11/08 23:06:38	1.3
--- sp_tcp_flag_check.c	2000/12/06 01:57:25	1.4
***************
*** 170,173 ****
--- 170,179 ----
      flagptr = otn_idx->ds_list[PLUGIN_TCP_FLAG_CHECK];
  
+ 
+ 
+     if (!p->tcph)
+ 	   return 0; /* if error appeared when tcp header was processed,
+ 	   	      * test fails automagically */
+ 
  #ifdef DEBUG
      printf("           <!!> CheckTcpFlagsEq: ");

Index: sp_tcp_seq_check.c
===================================================================
RCS file: /cvsroot/snort/snort/sp_tcp_seq_check.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** sp_tcp_seq_check.c	2000/08/07 02:42:27	1.1.1.1
--- sp_tcp_seq_check.c	2000/12/06 01:57:25	1.2
***************
*** 134,137 ****
--- 134,141 ----
  int CheckTcpSeqEq(Packet *p, struct _OptTreeNode *otn, OptFpList *fp_list)
  {
+     if (!p->tcph)
+ 	   return 0; /* if error appeared when tcp header was processed,
+ 	   	      * test fails automagically */
+ 	    
      if (((TcpSeqCheckData *)otn->ds_list[PLUGIN_TCP_ACK_CHECK])->tcp_seq == ntohl(p->tcph->th_seq))
      {

Index: sp_ttl_check.c
===================================================================
RCS file: /cvsroot/snort/snort/sp_ttl_check.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** sp_ttl_check.c	2000/08/07 02:42:27	1.1.1.1
--- sp_ttl_check.c	2000/12/06 01:57:25	1.2
***************
*** 125,128 ****
--- 125,131 ----
  int CheckTtlEq(Packet *p, struct _OptTreeNode *otn, OptFpList *fp_list)
  {
+     if (!p->iph)
+ 	    return 0; /* if error appeared while ip header was
+ 	               * processed, test fails autmagically */
      /* your detection function tests go here */
      if (((TtlCheckData *)otn->ds_list[PLUGIN_TTL_CHECK])->ttl == p->iph->ip_ttl)

_______________________________________________
Snort-cvsinfo mailing list
Snort-cvsinfo@lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/snort-cvsinfo

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic