Update to SMB service response time stats.
authorsahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 28 Sep 2003 00:00:36 +0000 (00:00 +0000)
committersahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 28 Sep 2003 00:00:36 +0000 (00:00 +0000)
For short packets, we might not have enough of the payload to decode
the transaction info levels  and thus that data structure is NULL.

check the pointer to this struct first before we try to dereference it.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@8558 f5534014-38df-0310-8fa8-9805f1628bb7

gtk/smb_stat.c
tap-smbstat.c

index 6b0dfd9ac8f9ed0a223a3bf8130cbaee1ac2b8c5..e539c1926ca2de077ac0a475444187cae2272b89 100644 (file)
@@ -1,7 +1,7 @@
 /* smb_stat.c
  * smb_stat   2003 Ronnie Sahlberg
  *
- * $Id: smb_stat.c,v 1.20 2003/09/26 02:09:44 guy Exp $
+ * $Id: smb_stat.c,v 1.21 2003/09/28 00:00:36 sahlberg Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -101,11 +101,15 @@ smbstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, void *psi
        if(si->cmd==0xA0){
                smb_nt_transact_info_t *sti=(smb_nt_transact_info_t *)si->sip->extra_info;
 
-               add_srt_table_data(&ss->nt_trans_srt_table, sti->subcmd, &si->sip->req_time, pinfo);
+               if(sti){
+                       add_srt_table_data(&ss->nt_trans_srt_table, sti->subcmd, &si->sip->req_time, pinfo);
+               }
        } else if(si->cmd==0x32){
                smb_transact2_info_t *st2i=(smb_transact2_info_t *)si->sip->extra_info;
 
-               add_srt_table_data(&ss->trans2_srt_table, st2i->subcmd, &si->sip->req_time, pinfo);
+               if(st2i){
+                       add_srt_table_data(&ss->trans2_srt_table, st2i->subcmd, &si->sip->req_time, pinfo);
+               }
        }
 
        return 1;
index 484de6abb2f80b6f91b973a42328f14ff3b2d0c0..6a383e61aea42c628981b8441ed624ec0c6169a1 100644 (file)
@@ -1,7 +1,7 @@
 /* tap-smbstat.c
  * smbstat   2003 Ronnie Sahlberg
  *
- * $Id: tap-smbstat.c,v 1.4 2003/04/25 20:54:16 guy Exp $
+ * $Id: tap-smbstat.c,v 1.5 2003/09/28 00:00:36 sahlberg Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -56,7 +56,7 @@ smbstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, void *psi
        smbstat_t *ss=(smbstat_t *)pss;
        smb_info_t *si=psi;
        nstime_t delta;
-       timestat_t *sp;
+       timestat_t *sp=NULL;
 
        /* we are only interested in reply packets */
        if(si->request){
@@ -71,12 +71,16 @@ smbstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, void *psi
                smb_nt_transact_info_t *sti=(smb_nt_transact_info_t *)si->sip->extra_info;
 
                /*nt transaction*/
-               sp=&(ss->nt_trans[sti->subcmd]);
+               if(sti){
+                       sp=&(ss->nt_trans[sti->subcmd]);
+               }
        } else if(si->cmd==0x32){
                smb_transact2_info_t *st2i=(smb_transact2_info_t *)si->sip->extra_info;
 
                /*transaction2*/
-               sp=&(ss->trans2[st2i->subcmd]);
+               if(st2i){
+                       sp=&(ss->trans2[st2i->subcmd]);
+               }
        } else {
                sp=&(ss->proc[si->cmd]);
        }
@@ -89,7 +93,9 @@ smbstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, void *psi
                delta.secs--;
        }
 
-       time_stat_update(sp,&delta, pinfo);
+       if(sp){
+               time_stat_update(sp,&delta, pinfo);
+       }
 
        return 1;
 }