X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Froute.c;h=ee36a9bfe4b17c8289d85053312a7d44ed2692c3;hb=be83b0af60449c7b35d17d97f2e6dc12f611e831;hp=4de61026af6def9191309429a86c8457c9de419f;hpb=fd7e81983ca4cae7cdf2a67a35500284f17761c4;p=meshlink diff --git a/src/route.c b/src/route.c index 4de61026..ee36a9bf 100644 --- a/src/route.c +++ b/src/route.c @@ -26,6 +26,8 @@ #include "utils.h" static bool checklength(node_t *source, vpn_packet_t *packet, uint16_t length) { + assert(length); + if(packet->len < length) { logger(source->mesh, MESHLINK_WARNING, "Got too short packet from %s", source->name); return false; @@ -35,6 +37,8 @@ static bool checklength(node_t *source, vpn_packet_t *packet, uint16_t length) { } void route(meshlink_handle_t *mesh, node_t *source, vpn_packet_t *packet) { + assert(source); + // TODO: route on name or key meshlink_packethdr_t *hdr = (meshlink_packethdr_t *) packet->data;