Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] plugin_if_goto_frame causes protection exception

From: Roland Knall <rknall@xxxxxxxxx>
Date: Sat, 28 Nov 2015 07:46:27 +0100
You should commit this change via gerrit. I think it is ok but you should also check in your code if a call is valid or not by checking for a loaded trace. 

Regards, Roland



Am 27.11.2015 um 23:52 schrieb Paul Offord <Paul.Offord@xxxxxxxxxxxx>:

Hi,

 

If you call plugin_if_goto_frame when there is no capture file loaded you get an Protection Exception in cf_goto_frame (in file.c).

 

The code is:

 

gboolean

cf_goto_frame(capture_file *cf, guint fnumber)

{

  frame_data *fdata;

 

  fdata = frame_data_sequence_find(cf->frames, fnumber);   // *** problem occurs here as cf is NULL

 

  if (fdata == NULL) {

    /* we didn't find a packet with that packet number */

    statusbar_push_temporary_msg("There is no packet number %u.", fnumber);

 

The problem can be avoided by changing the code to this:

 

gboolean

cf_goto_frame(capture_file *cf, guint fnumber)

{

  frame_data *fdata;

 

  if (cf == NULL) {

                 /* we don't have a loaded capture file */

                 statusbar_push_temporary_msg("There is no file loaded");

                 return FALSE;   /* we failed to go to that packet */

  }

  else

  {

                 fdata = frame_data_sequence_find(cf->frames, fnumber);

  }

 

  if (fdata == NULL) {

    /* we didn't find a packet with that packet number */

    statusbar_push_temporary_msg("There is no packet number %u.", fnumber);

  .

  .

 

I’ve tested the above and it seems to work OK.

 

Is this acceptable to be reported as a bug or is the view that I should have checked there was a capture file loaded before I made the call?

 

Thanks and regards…Paul

 


______________________________________________________________________

This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.

Any views or opinions expressed are solely those of the author and do not necessarily represent those of Advance Seven Ltd. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission.

Advance Seven Ltd. Registered in England & Wales numbered 2373877 at Endeavour House, Coopers End Lane, Stansted, Essex CM24 1SJ

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
            mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe