Ethereal-dev: [Ethereal-dev] patch to packet-postgresql.c dissector

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

From: Edwin Calo <calo@xxxxxxxxxxxx>
Date: Thu, 19 Feb 2004 22:19:16 -0600
This is a patch for packet-postgresql.c

There was a fixed in the way the bitone was obtained 
(now using the correct guint8)that modified how the offset is handle.

So I create this patch that fix it.

I'm also attaching a sample postgresql trace.  Thanks.



--- packet-postgresql.c	2004-02-19 00:03:00.000000000 -0600
+++ packet-postgresql.c	2004-02-19 00:27:52.000000000 -0600
@@ -80,7 +80,7 @@
 
     counter=0;
     flag=0;
-    while ( buff_remaining > 1 )
+    while ( buff_remaining >= 1 )
     {
          bitone = tvb_get_guint8 (tvb, offset);
          offset += 1;
@@ -91,7 +91,7 @@
 	    {
 	      if(offset > counter)
 	      {
-                   offset -= counter;
+                   offset -= counter+1;
 
                     /* Reading the string from the packet */
                     string = tvb_get_string(tvb,offset,counter);
@@ -101,7 +101,7 @@
 		    g_free(string);  /* Freeing up string */
                     string=NULL;
 
-                   offset += counter;
+                   offset += counter+1;
 	           counter=0;
 	      }
 	      else
@@ -123,7 +123,7 @@
                 { 
                   if(offset > counter)
                   {
-                   offset -= counter;
+                   offset -= counter+1;
 		   if( counter > 1)
 		   {
                     /* Reading the string from the packet */
@@ -135,7 +135,7 @@
                     string=NULL;
 
                    }
-		   offset += counter;
+		   offset += counter+1;
                   }
                   counter = 0;
                 }

Attachment: psql_test.dump.gz
Description: GNU Zip compressed data