]> git.meshlink.io Git - catta/blobdiff - avahi-core/netlink.c
Fix a bug where Avahi does not verify the source of netlink messages
[catta] / avahi-core / netlink.c
index b2a6684c60445fd93356a6ec789c47863990cbdf..893295dd741bc8ab4c321bc8dceef8cbe7cfe97d 100644 (file)
@@ -62,6 +62,12 @@ int avahi_netlink_work(AvahiNetlink *nl, int block) {
 
     p = (struct nlmsghdr *) nl->buffer;
     
+    /* Check that this message originated from the kernel,
+       or a request from avahi itself, and not another process */
+    if ((p->nlmsg_pid != 0) && (p->nlmsg_pid != getpid())) {
+        return -1;
+    }
+
     assert(nl->callback);
     
     for (; bytes > 0; p = NLMSG_NEXT(p, bytes)) {