]> git.meshlink.io Git - meshlink/blobdiff - src/protocol_auth.c
asserts added to make sure devclass is valid
[meshlink] / src / protocol_auth.c
index 82254593e36aa0a5982ad447dae801c5baa76f89..d359b9b638c9aae8e9699201317bc5d470bb285f 100644 (file)
@@ -36,7 +36,9 @@
 #include "utils.h"
 #include "xalloc.h"
 #include "ed25519/sha512.h"
-    
+
+#include <assert.h>
+
 extern bool node_write_devclass(meshlink_handle_t *mesh, node_t *n);
 
 static bool send_proxyrequest(meshlink_handle_t *mesh, connection_t *c) {
@@ -444,6 +446,8 @@ bool ack_h(meshlink_handle_t *mesh, connection_t *c, const char *request) {
 
        /* Create an edge_t for this connection */
 
+       assert(devclass >= 0 && devclass <= _DEV_CLASS_MAX);
+
        c->edge = new_edge();
        c->edge->from = mesh->self;
        c->edge->to = n;