import struct


def deserialize_string(data: bytes, encoding: str) -> str:
    """Deserialize a string (null-terminated with length)."""
    (length,) = struct.unpack("<H", data[:2])
    return str(data[2 : 2 + length - 1], encoding)