Pumpkin-MC/Pumpkin · error · PacketError

Missing packet null terminator

Error message

Missing packet null terminator

What it means

PacketError framing guard while reading an RCON packet: the payload did not end with the required NUL terminator bytes before the declared length ran out. The offending input is the trailing bytes of the RCON body — a client that omitted the terminating NUL(s), indicating a non-conforming or corrupted RCON implementation.

Solutions

  1. Drop the malformed packet
  2. Validate the null terminators before reading the body string
  3. Log the malformed packet at debug level
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/pumpkin-protocol/src/rcon.rs:56 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09). Data as JSON: /api/errors/4b70a1c378edac67. Report an issue: GitHub.

Appendix: source

Thrown at crates/pumpkin-protocol/src/rcon.rs:56

        // 10 is for 4 bytes ty, 4 bytes id, and 2 terminating nul bytes.
        buf.put_i32_le(10 + body.len() as i32);
        buf.put_i32_le(id);
        buf.put_i32_le(self as i32);
        let bytes = body.as_bytes();
        buf.put_slice(bytes);
        buf.put_u8(0);
        buf.put_u8(0);
        buf
    }
}

#[derive(Error, Debug)]
pub enum PacketError {
    #[error("Invalid length")]
    InvalidLength,
    #[error("Failed to send packet: {0}")]
    FailedSend(std::io::Error),
    #[error("Missing packet null terminator")]
    MissingNullTerminator,
    #[error("Invalid packet string body: {0}")]
    InvalidBody(std::str::Utf8Error),
    #[error("Unknown packet type: {0}")]
    UnknownPacketType(i32),
}

#[derive(Debug, PartialEq, Eq)]
/// Serverbound packet
pub struct Packet {
    id: i32,
    ptype: ServerboundPacket,
    body: Box<str>,
}

impl Packet {
    pub fn deserialize(incoming: &mut Vec<u8>) -> Result<Option<Self>, PacketError> {
        // We need at least 4 bytes to read the packet length header

View on GitHub (pinned to 8d4639e25a)