Skip to content

macnockserver.c can misplace terminating NULL #4

@pbug44

Description

@pbug44

The rule goes "never trust the network" and on macnockserver.c line 94, it says this:

nock->hood[nock->hoodLen] = '\0';

instead of using nock->hoodLen, it's better to calculate the hoodlen from the received packetlength, which is called recvlen. It doesn't overrun the buffer though because the buffer is 2048 bytes and it's impossible to do so.

nock->hoodLen is maximally 255 bytes (type uint8_t).

I'm trying to figure out more fallout to this, but nothing comes to my mind right now, the only thing that touch nock->hood after is log_trace("%s"), one would have to trace it back inside there then to see if there is a buffer overflow or anythign of the likes.

Good evening.
-peter

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