recv() and recvfrom() return int, do not prematurely cast the return value.
[tinc] / src / meta.c
index 1bb634f..a3f7ef3 100644 (file)
@@ -76,7 +76,7 @@ void broadcast_meta(connection_t *from, const char *buffer, int length) {
 }
 
 bool receive_meta(connection_t *c) {
-       size_t inlen;
+       int inlen;
        char inbuf[MAXBUFSIZE];
        char *bufp = inbuf, *endp;
 
@@ -117,7 +117,7 @@ bool receive_meta(connection_t *c) {
                        bufp = endp;
                } else {
                        size_t outlen = inlen;
-                       ifdebug(META) logger(LOG_DEBUG, "Received encrypted %zu bytes", inlen);
+                       ifdebug(META) logger(LOG_DEBUG, "Received encrypted %d bytes", inlen);
                        evbuffer_expand(c->buffer->input, c->buffer->input->off + inlen);
 
                        if(!cipher_decrypt(&c->incipher, bufp, inlen, c->buffer->input->buffer + c->buffer->input->off, &outlen, false) || inlen != outlen) {