GitHub CI: update list of container images
[tinc] / src / protocol_misc.c
index cef7e3d..b68179d 100644 (file)
@@ -68,7 +68,8 @@ bool pong_h(connection_t *c, const char *request) {
 
        if(c->outgoing && c->outgoing->timeout) {
                c->outgoing->timeout = 0;
-               reset_address_cache(c->outgoing->node->address_cache, &c->address);
+               reset_address_cache(c->node->address_cache);
+               add_recent_address(c->node->address_cache, &c->address);
        }
 
        return true;
@@ -104,7 +105,7 @@ bool send_tcppacket(connection_t *c, const vpn_packet_t *packet) {
 bool tcppacket_h(connection_t *c, const char *request) {
        short int len;
 
-       if(sscanf(request, "%*d %hd", &len) != 1) {
+       if(sscanf(request, "%*d %hd", &len) != 1 || len < 0) {
                logger(DEBUG_ALWAYS, LOG_ERR, "Got bad %s from %s (%s)", "PACKET", c->name,
                       c->hostname);
                return false;
@@ -136,7 +137,7 @@ bool send_sptps_tcppacket(connection_t *c, const void *packet, size_t len) {
 bool sptps_tcppacket_h(connection_t *c, const char *request) {
        short int len;
 
-       if(sscanf(request, "%*d %hd", &len) != 1) {
+       if(sscanf(request, "%*d %hd", &len) != 1 || len < 0) {
                logger(DEBUG_ALWAYS, LOG_ERR, "Got bad %s from %s (%s)", "SPTPS_PACKET", c->name,
                       c->hostname);
                return false;