Wireshark mailing list archives

Lua stringz


From: "Maynard, Christopher via Wireshark-dev" <wireshark-dev () wireshark org>
Date: Fri, 29 Jan 2021 21:00:18 +0000

Hi list,

I was successfully using tvbrange:stringz() to retrieve a NULL-terminated string from a tvb, that is until I recently 
encountered a string containing extended-ASCII characters, at which point things starting failing because the length of 
the string returned was too long.  To work around the problem, I switched to using tvbrange:strsize() instead.

To help illustrate the problem, I've attached a simple Lua dissector and pcap file.  The Lua dissector has a preference 
for switching between using stringz() or strsize().  I've also attached the exported textual representations, both with 
"use_stringz" enabled and with it disabled (so it's using strsize() instead).

Is this expected, or is this perhaps a bug?  Has anyone else encountered something like this?

Thanks.
- Chris
Ref:
11.8.3.21. tvbrange:stringz([encoding])
11.8.3.22. tvbrange:strsize([encoding])
https://www.wireshark.org/docs/wsdg_html_chunked/lua_module_Tvb.html












CONFIDENTIALITY NOTICE: This message is the property of International Game Technology PLC and/or its subsidiaries and 
may contain proprietary, confidential or trade secret information. This message is intended solely for the use of the 
addressee. If you are not the intended recipient and have received this message in error, please delete this message 
from your system. Any unauthorized reading, distribution, copying, or other use of this message or its attachments is 
strictly prohibited.

Attachment: foo_stringz_false.txt
Description: foo_stringz_false.txt

Attachment: foo_stringz_true.txt
Description: foo_stringz_true.txt

Attachment: foo.lua
Description: foo.lua

Attachment: foo_stringz.pcap
Description: foo_stringz.pcap

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: