Ethereal-dev: Re: [Ethereal-dev] [patch] Fix for tvb_uncompress/http content-encoding: gzip

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

From: "Kelly Byrd" <kbyrd-ethereal@xxxxxxxxxx>
Date: Sun, 1 Aug 2004 16:28:59 -0700 (PDT)
Any reason this didn't get checked in?

KB

> This is a patch for epan/tvbuff.c
> tvb_uncompress didn't parse the gzip header flags correctly.
> When looking to see if bit 3 (bit 0 being least significant),
> was set, the checked in code does:
> if (flag & 0x3) {
> instead of something like:
> if (flag & (1 << 0x3))  {
>
> This was causing gzip encoded packets to not be uncompressed
> for me.
>
> My diff does bit shifting, obviously there are other ways to
> do this. If someone else has a stong preference for another
> form of bit masking, like (flag & 0x8), they are welcome to
> substitue that for mine.
>
> Index: epan/tvbuff.c
> ===================================================================
> --- epan/tvbuff.c       (revision 11523)
> +++ epan/tvbuff.c       (working copy)
> @@ -2342,7 +2342,7 @@
>                         /* Skip past the MTIME, XFL, and OS fields. */
>                         c += 7;
>
> -                       if (flags & 0x2) {
> +                       if (flags & (1 << 0x2)) {
>                                 /* An Extra field is present. */
>                                 gint xsize = (gint)(*c |
>                                     (*(c + 1) << 8));
> @@ -2350,7 +2350,7 @@
>                                 c += xsize;
>                         }
>
> -                       if (flags & 0x3) {
> +                       if (flags & (1 << 0x3)) {
>                                 /* A null terminated filename */
>
>                                 while (*c != '\0') {
> @@ -2360,7 +2360,7 @@
>                                 c++;
>                         }
>
> -                       if (flags & 0x4) {
> +                       if (flags & (1 << 0x4)) {
>                                 /* A null terminated comment */
>
>                                 while (*c != '\0') {
>
>
>