Fix typo in src/upnp.c.
[tinc] / src / protocol.c
index fb90c94..b9abccc 100644 (file)
@@ -41,7 +41,8 @@ static bool (*request_handlers[])(connection_t *, const char *) = {
                add_subnet_h, del_subnet_h,
                add_edge_h, del_edge_h,
                key_changed_h, req_key_h, ans_key_h, tcppacket_h, control_h,
-               NULL, NULL, NULL, /* Not "real" requests (yet) */
+               NULL, NULL, /* Not "real" requests (yet) */
+               sptps_tcppacket_h,
                udp_info_h, mtu_info_h,
 };
 
@@ -71,10 +72,11 @@ bool send_request(connection_t *c, const char *format, ...) {
           input buffer anyway */
 
        va_start(args, format);
-       len = vsnprintf(request, MAXBUFSIZE, format, args);
+       len = vsnprintf(request, sizeof request, format, args);
+       request[sizeof request - 1] = 0;
        va_end(args);
 
-       if(len < 0 || len > MAXBUFSIZE - 1) {
+       if(len < 0 || len > sizeof request - 1) {
                logger(DEBUG_ALWAYS, LOG_ERR, "Output buffer overflow while sending request to %s (%s)",
                           c->name, c->hostname);
                return false;