Skip to content

panic when dumping some RadioTap packets #113

@robertkleffner

Description

@robertkleffner

Overview

I have been capturing some Wifi traffic in monitor mode, and came across a panic when calling the String() method on the Packet interface for some packets. I managed to capture the bytes of an offending packet and created a very small reproduction program below.

The panic message that I get says:

panic: value method github.com/gopacket/gopacket/layers.Dot11CodingType.String called using nil *Dot11CodingType pointer

It is fine if this is not a valid packet, but it would be nice if it showed up as a decode error of some sort. I'm not entirely sure what the cause for this is, as I'm not expert here (yet), but I can look into it more as this happens fairly regularly for me.

Reproduction

package main

import (
	"log/slog"

	"github.com/gopacket/gopacket"
	"github.com/gopacket/gopacket/layers"
)

func main() {
	pkt := []byte{
		0, 0, 48, 0, 46, 64, 64, 160, 32, 8, 0, 160, 32, 8, 0, 0, 80,
		12, 133, 9, 192, 0, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 229,
		109, 1, 0, 0, 0, 0, 22, 0, 17, 3, 175, 0, 173, 1, 96, 204, 167,
		242, 184, 15, 207, 1, 120, 226, 240, 116, 33, 39, 49, 116, 91,
		202, 181, 58, 126, 72, 77, 133, 213, 10, 90, 22, 99, 122, 120,
		218, 169, 221, 207, 134, 235, 30, 124, 156, 34, 64, 153, 155,
		142, 1, 165, 5, 57, 219, 78, 116, 237, 169, 46, 91, 133, 242,
		215, 171, 31, 153, 93, 222, 93, 58, 174, 1, 178, 184, 65, 188,
		152, 119, 217, 172, 145, 75, 215, 101, 100, 95, 212, 60, 32, 30,
		129, 46, 223, 158, 65, 61, 21, 176, 161, 34, 198, 164, 116, 94,
		124, 200, 190, 65, 121, 178, 129, 12, 153, 191, 180, 57, 101, 218,
		25, 102, 30, 250, 25, 142, 108, 162, 112, 122, 194, 246, 229, 238,
		157, 215, 188, 186, 31, 27, 40, 80, 4, 149, 56, 75, 167, 39, 51, 52,
		143, 175, 213, 196, 227, 5, 38, 234, 143, 89, 122, 201, 245, 26, 102,
		41, 169, 151, 0, 46, 3, 159, 22, 137, 168, 211, 76, 133, 161, 174, 212,
		67, 162, 203, 15, 58, 123, 55, 136, 156, 82, 121, 238, 249, 96, 53,
		226, 231, 140, 79, 19, 226, 124, 145, 217, 218, 31, 70, 167, 219, 199,
		124, 249, 232, 152, 176, 144, 169, 90, 26, 154, 175, 247, 161, 121,
		183, 167, 248, 242, 152, 36, 254, 203, 176, 13, 126, 149, 223, 252,
		141, 64, 92, 183,
	}

	parsed := gopacket.NewPacket(pkt, layers.LayerTypeRadioTap, gopacket.DecodeOptions{Lazy: false, DecodeStreamsAsDatagrams: true})
	slog.Info(parsed.String())
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions