ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-users: Re: [Wireshark-users] Reading a zero-terminated string in Lua dissector

From: Carsten Fuchs <carsten.fuchs@xxxxxxx>
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