Wireshark-dev: Re: [Wireshark-dev] Fwd: ethereal hangs.
From: Gerald Combs <gerald@xxxxxxxxxxxxx>
Date: Tue, 26 Sep 2006 22:24:16 -0700
prashanth joshi wrote:

> Hi
> I wrote and then tried to run the following code.
> But the ethereal is hanging.
> Please any one me tell what may be wrong with it.
> Obviously my intention here is to parse the CDR's
> Regards,
> Prashanth.

    [...]

> int my_decode_cdr (tvbuff_t * tvb, int offset, packet_info *pinfo _U_ ,
> proto_tree *tree, int record_length)
> {
> int retval, i, flag;
> guint8 type;
> int check_extension_val;
> int count = 0;
>    while(count != record_length)
>    {
>    /* fetch type field of each information element in record */
>       type = tvb_get_guint8(tvb, offset);
>       i = 0; flag = 0;
>       switch(type)
>       {
>       case 0x7F: retval = decode_gtp_chrg_id ( tvb, offset, pinfo,tree);

What happens if retval is 0 here?

>                  offset = offset + retval;
>                  count = count + retval;
>                  break;
>       default : offset + 1;
>                  count + 1;
>                  break;
>       }
>  
>    }
>  
> return count;
> }