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

Wireshark-bugs: [Wireshark-bugs] [Bug 6592] New: header value always computed twice

Date: Thu, 17 Nov 2011 05:22:47 -0800 (PST)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6592

           Summary: header value always computed twice
           Product: Wireshark
           Version: SVN
          Platform: Other
        OS/Version: Windows XP
            Status: NEW
          Severity: Enhancement
          Priority: Low
         Component: TShark
        AssignedTo: bugzilla-admin@xxxxxxxxxxxxx
        ReportedBy: cbley@xxxxxxxxxx


Claudio <cbley@xxxxxxxxxx> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #7427|                            |review_for_checkin?
               Flag|                            |

Created an attachment (id=7427)
 --> (https://bugs.wireshark.org/bugzilla/attachment.cgi?id=7427)
remove duplicate code

Build Information:
TShark 1.7.1 (SVN Rev 39897 from /trunk)

Copyright 1998-2011 Gerald Combs <gerald@xxxxxxxxxxxxx> and contributors.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiled (64-bit) with GLib 2.24.1, with libpcap 1.0.0, with libz 1.2.3.3,
without POSIX capabilities, without SMI, without c-ares, without ADNS, without
Lua, with Python 2.6.5, without GnuTLS, without Gcrypt, without Kerberos,
without GeoIP.

Running on Linux 2.6.32-33-server, with locale en_US.UTF-8, with libpcap
version
1.0.0, with libz 1.2.3.3.

Built using gcc 4.4.3.

--
I'm not quite sure whether I should report that here, because it's so minor.
Anyway, here goes:

In packet-http.c, process_header() starting at line 1982:
=== snip ===
    /*
     * Skip whitespace after the colon.
     */
    value_offset = colon_offset + 1;
    while (value_offset < line_end_offset
            && ((c = line[value_offset - offset]) == ' ' || c == '\t'))
        value_offset++;

    /*
     * Fetch the value.
     */
    value_len = line_end_offset - value_offset;
    value = ep_strndup(&line[value_offset - offset], value_len);

    if (hf_index == -1) {
[...]
    } else {
        /*
         * Skip whitespace after the colon.
         */
        value_offset = colon_offset + 1;
        while (value_offset < line_end_offset
            && ((c = line[value_offset - offset]) == ' ' || c == '\t'))
            value_offset++;

        /*
         * Fetch the value.
         */
        value_len = line_end_offset - value_offset;
        value = ep_strndup(&line[value_offset - offset], value_len);
==== snip ===

Why is value_offset, value_len and value always computed twice (for known
headers)?

-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.