]> git.meshlink.io Git - meshlink/blobdiff - src/route.c
Add assert() calls to the library.
[meshlink] / src / route.c
index 4de61026af6def9191309429a86c8457c9de419f..ee36a9bfe4b17c8289d85053312a7d44ed2692c3 100644 (file)
@@ -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;