chiark / gitweb /
libudev: fix check for too long packet
authorTopi Miettinen <toiwoton@gmail.com>
Sun, 18 Jan 2015 21:57:35 +0000 (23:57 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Sun, 18 Jan 2015 22:31:11 +0000 (23:31 +0100)
Don't use recvmsg(2) return value to check for too long packets
(it doesn't work) but MSG_TRUNC flag.

(David: add parantheses around condition)

src/libudev/libudev-monitor.c

index 484fefeebfe27261167aef5acbf7cb6f26c4f41c..0d361426f7c23c7354cbc9e544ed4a6ff5e54e67 100644 (file)
@@ -609,7 +609,7 @@ retry:
                 return NULL;
         }
 
-        if (buflen < 32 || (size_t)buflen >= sizeof(buf)) {
+        if (buflen < 32 || (smsg.msg_flags & MSG_TRUNC)) {
                 log_debug("invalid message length");
                 return NULL;
         }