]> git.meshlink.io Git - meshlink/blobdiff - src/protocol.c
Fix potential NULL pointer dereference.
[meshlink] / src / protocol.c
index 5d28883778aa4957a5b849e547aee89a422c76f6..39f529a268045ef78a1956a1970380dc440c719e 100644 (file)
@@ -67,10 +67,14 @@ bool check_id(const char *id) {
    detection as well */
 
 bool send_request(meshlink_handle_t *mesh, connection_t *c, const submesh_t *s, const char *format, ...) {
-       assert(c);
        assert(format);
        assert(*format);
 
+       if(!c) {
+               logger(mesh, MESHLINK_ERROR, "Trying to send request to non-existing connection");
+               return false;
+       }
+
        va_list args;
        char request[MAXBUFSIZE];
        int len;