Wireshark mailing list archives

Re: Reading a zero-terminated string in Lua dissector


From: Carsten Fuchs <carsten.fuchs () cafu de>
Date: Wed, 06 Jun 2012 00:13:12 +0200

Am 2012-06-04 22:22, schrieb Tony Trinh:
    local function getStringLength(buffer, offset)
         return buffer(offset):stringz():len()
    end

Thanks!
(Fyi, I just added a "+ 1" to also count the trailing zero, so that the offset for the next data item properly steps over it.)

Hope that helps.

It does, very much!
Tony, thank you very much for your detailed answer!

Best regards,
Carsten




--
   Cafu - the open-source Game and Graphics Engine
for multiplayer, cross-platform, real-time 3D Action
          Learn more at http://www.cafu.de

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


Current thread: