Skip to content

Uninitialized Protocol data members in Protocol_init #2

@mescalan

Description

@mescalan

Protocol_init doesn't initialize all structure fields. Probably should memset the "struct Protocol* obj" to '0', and then assign the port.

(gdb) p/x *obj
$4 = {
cmd = 0x0,
size = 0x0,
addr = 0x0,
data = 0x0,
checksum = 0x0,
byteNumber = 0x0,
payload = {0x0, 0x0, 0x0, 0x0, 0x14, 0x0, 0x80, 0x0, 0x12, 0x0, 0x1, 0x1,
0x0, 0x0, 0x0, 0x0},
executePacket = 0x0,
return_data = 0x0,
special = 0x0,
port = 0x80,
dataRegisters = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5, 0x15,
0x0, 0x0, 0x0, 0x8e, 0x71},
uartTxData = {0xa2, 0x9a, 0x9e, 0x43, 0xe0, 0x16, 0x92, 0xde, 0x78, 0x32,
0xe9, 0x3, 0x0, 0x0, 0x1, 0x5}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions