Wireshark-dev: Re: [Wireshark-dev] new packet list: crash on Decode-As
From: Jakub Zawadzki <darkjames@xxxxxxxxxxxxxxxx>
Date: Tue, 15 Sep 2009 15:32:07 +0200
Hi,

On Tue, Sep 15, 2009 at 03:19:03PM +0200, Anders Broman wrote:
> Could you try revision 29920?

It's working for me, but I really don't like the solution.
(I don't have a better one, so I think it's better than nothing)

Anyway, can you apply this patch?
It makes some cleanup, and fix copy&paste error in sizeof()
diff --git file.c file.c
index b2c31ca..4099c3d 100644
--- file.c
+++ file.c
@@ -1280,12 +1280,10 @@ read_packet(capture_file *cf, dfilter_t *dfcode,
   fdata->flags.marked = 0;
   fdata->flags.ref_time = 0;
   fdata->color_filter = NULL;
-  fdata->col_text = NULL;
-  fdata->col_text_len = NULL;
 
   fdata->abs_ts.secs = phdr->ts.secs;
   fdata->abs_ts.nsecs = phdr->ts.nsecs;
-  fdata->col_text_len = se_alloc0(sizeof(fdata->col_text) * (cf->cinfo.num_cols));
+  fdata->col_text_len = se_alloc0(sizeof(fdata->col_text_len) * (cf->cinfo.num_cols));
   fdata->col_text = se_alloc0(sizeof(fdata->col_text) * (cf->cinfo.num_cols));
 
   if (cf->plist_end != NULL)
@@ -2158,7 +2156,7 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item,
 	   * And after that fdata->col_text (which is allocated using se_alloc0())
 	   * no longer points to valid memory.
 	   */
-	    fdata->col_text_len = se_alloc0(sizeof(fdata->col_text) * (cf->cinfo.num_cols));
+	    fdata->col_text_len = se_alloc0(sizeof(fdata->col_text_len) * (cf->cinfo.num_cols));
 		fdata->col_text = se_alloc0(sizeof(fdata->col_text) * (cf->cinfo.num_cols));
     }