sqlmapproject/sqlmap · error · ValueError

truncated DNS pointer

Error message

truncated DNS pointer

What it means

_skipName encountered a compression pointer (top two bits 11) but fewer than 2 bytes remain, so the pointer target cannot be read. The DNS response is truncated at the pointer, and the decoder refuses to follow a partial reference.

Solutions

  1. Retry the DNS query — UDP responses get truncated; use TCP if the TC bit is set.
  2. Verify the packet offset arithmetic before the name field.
  3. Check the resolver/server for malformed responses.
  4. Parse with a hardened DNS library if custom responses must be supported.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at extra/kerberos/discovery.py:99 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sqlmapproject/sqlmap@0a35b20e39 (2026-08-26). Data as JSON: /api/errors/42774076a3e7376f. Report an issue: GitHub.

Appendix: source

Thrown at extra/kerberos/discovery.py:99

    out = bytearray()
    for label in name.split("."):
        out.append(len(label))
        out += label.encode("ascii")
    out.append(0)
    return bytes(out)

_MAX_NAME_JUMPS = 64                                       # guards against compression-pointer cycles

def _skipName(data, offset):
    while True:
        if offset >= len(data):
            raise ValueError("truncated DNS name")
        length = data[offset]
        if length == 0:
            return offset + 1
        if length & 0xc0 == 0xc0:                          # compression pointer ends the name
            if offset + 2 > len(data):
                raise ValueError("truncated DNS pointer")
            return offset + 2
        offset += 1 + length

def _readName(data, offset):
    labels = []
    end = None
    jumps = 0
    while True:
        if offset >= len(data):
            raise ValueError("truncated DNS name")
        length = data[offset]
        if length == 0:
            offset += 1
            break
        if length & 0xc0 == 0xc0:                          # follow compression pointer (bounded, cycle-safe)
            if offset + 2 > len(data):
                raise ValueError("truncated DNS pointer")
            jumps += 1

View on GitHub (pinned to 0a35b20e39)