diff options
author | Mattias Andrée <maandree@kth.se> | 2017-10-21 18:39:42 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2017-10-21 18:39:42 +0200 |
commit | c8843d3391a1b2139255d46a23104ada9a12d207 (patch) | |
tree | e2a6a54a23a5372640ccfe8e83f4c88f74b554a6 | |
parent | Add flags to functions using send (diff) | |
download | sbus-c8843d3391a1b2139255d46a23104ada9a12d207.tar.gz sbus-c8843d3391a1b2139255d46a23104ada9a12d207.tar.bz2 sbus-c8843d3391a1b2139255d46a23104ada9a12d207.tar.xz |
libsbus_receive: check message length to avoid reading outside it
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r-- | libsbus.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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; |