X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fprotocol.c;h=eadca13fc3790a3ddd41750f5c864cf0bce596db;hp=5b8b7ba3372e9b40b0b4321f694ee49ce8564d38;hb=ed20896612bcee11ff4180ff78ede950623c2fa6;hpb=4a5c12ec97fa1e82aae2d327fdc648e5203eb478 diff --git a/src/protocol.c b/src/protocol.c index 5b8b7ba3..eadca13f 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -1,7 +1,7 @@ /* protocol.c -- handle the meta-protocol, basic functions Copyright (C) 1999-2005 Ivo Timmermans, - 2000-2015 Guus Sliepen + 2000-2016 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -75,10 +75,11 @@ bool send_request(connection_t *c, const char *format, ...) { input buffer anyway */ va_start(args, format); - len = vsnprintf(buffer, MAXBUFSIZE, format, args); + len = vsnprintf(buffer, sizeof buffer, format, args); + buffer[sizeof buffer - 1] = 0; va_end(args); - if(len < 0 || len > MAXBUFSIZE - 1) { + if(len < 0 || len > sizeof buffer - 1) { logger(LOG_ERR, "Output buffer overflow while sending request to %s (%s)", c->name, c->hostname); return false;