[systemd-devel] [PATCH] libudev: fix check for too long packet

Topi Miettinen toiwoton at gmail.com
Sun Jan 18 13:57:35 PST 2015


Don't use recvmsg(2) return value to check for too long packets
(it doesn't work) but MSG_TRUNC flag.
---
 src/libudev/libudev-monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c
index 484fefe..d8e551b 100644
--- a/src/libudev/libudev-monitor.c
+++ b/src/libudev/libudev-monitor.c
@@ -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;
         }
-- 
2.1.4



More information about the systemd-devel mailing list