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 5960] TvbRange_string(lua_State* L) call a wrong function

Date: Wed, 15 Jun 2011 19:27:39 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5960

Tony Trinh <tony19@xxxxxxxxx> changed:

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

--- Comment #2 from Tony Trinh <tony19@xxxxxxxxx> 2011-06-15 22:27:37 EDT ---
Created an attachment (id=6507)
 --> (https://bugs.wireshark.org/bugzilla/attachment.cgi?id=6507)
Patch uses correct function and fixes TvbRange:string()

The attached patch fixes TvbRange:string() so that it returns a string that
contains all bytes of the range, including zeroes (instead of being truncated
at first zero). (ref: http://www.lua.org/manual/5.1/manual.html#pdf-string.len)

Test:

    local bytes = ByteArray.new("00 64 00 66 00")
    local tvb = ByteArray.tvb(bytes, "Test")
    print("tvblen",tvb:len())
    print("slen", tvb(0):string():len())
    assert( tvb:len() == tvb(0):string():len(), "Bug 5960" )

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