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
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