aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libsbus.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libsbus.c b/libsbus.c
index 9b8b9ad..4a913ec 100644
--- a/libsbus.c
+++ b/libsbus.c
@@ -69,7 +69,7 @@ libsbus_receive(int fd, int flags, char *buf, union libsbus_packet *packet)
if (r < 0)
return -1;
- if (!strncmp(buf, "MSG ", 4)) {
+ if (r >= 4 && !strncmp(buf, "MSG ", 4)) {
p = memchr(buf, '\0', r);
if (!*p++)
goto unknown;