Use sizeof for custom sizes

This commit is contained in:
Alex D. 2021-01-03 17:34:07 +00:00
parent 17fb6344bd
commit 75480d3606
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
1 changed files with 2 additions and 2 deletions

View File

@ -324,7 +324,7 @@ main(int argc, char* argv[])
LOG(LOG_WARN, "%s", "Received invalid IRC message (see RFC2812).");
} else if (len == -1) {
connection.info.state = CONN_RECONNECTING;
} else if (buf.fifo.append_pos == 512) {
} else if (buf.fifo.append_pos == sizeof(buf.fifo.buffer) - 1) {
LOG(LOG_WARN, "%s. %s.", "FIFO buffer is full and no message could be parsed", "Discarding buffer");
buf.fifo.append_pos = 0;
*buf.fifo.buffer = '\0';
@ -384,7 +384,7 @@ main(int argc, char* argv[])
LOG(LOG_WARN, "%s", "Received invalid IRC message (see RFC2812).");
} else if (len == -1) {
connection.info.state = CONN_RECONNECTING;
} else if (buf.recv.append_pos == 512) {
} else if (buf.recv.append_pos == sizeof(buf.recv.fd) - 1) {
LOG(LOG_WARN, "%s.", "Read buffer is full and no message could be parsed");
connection.info.state = CONN_RECONNECTING;
}