Ethereal-dev: Re: [Ethereal-dev] tvbuff questions and conclusions...

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

From: Gilbert Ramirez <gilramir@xxxxxxxxx>
Date: Tue, 13 Mar 2001 15:22:21 -0600
Guy Harris wrote:
> 
> 
> Gilbert, should "tvb_get_ptr()" be changed to return a "const guint8 *",
> to make it harder for code to scribble on the data in a tvbuff?
> 

It all cleaned up well, except for one case in which a dissector
*does* modify the tvbuff data. packet-ieee80211.c, line 600:

      for (i = 0; i < tag_len; i++)
        {

          if (tag_data_ptr[i] >= 128)
            {
              tag_data_ptr[i] -= 128;       /************* BAD!
**************/
              n += snprintf (out_buff + n, SHORT_STR - n, "%2.1f ",
(float)
                             (((float) tag_data_ptr[i]) * 0.5));
            }

          else
            n += snprintf (out_buff + n, SHORT_STR - n, "%2.1f ",
(float)
                           (((float) tag_data_ptr[i]) * 0.5));

        }
      snprintf (out_buff + n, SHORT_STR - n, "[Mbit/sec]");


It looks like it should be okay to rewrite this to correctly modify 'n',
without
modifying tag_data_ptr[i].

Johan, since your name is at the top of this file, does that sound okay?

--gilbert