diff options
Diffstat (limited to 'src/libunixonacid/unixmessage_put.c')
-rw-r--r-- | src/libunixonacid/unixmessage_put.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libunixonacid/unixmessage_put.c b/src/libunixonacid/unixmessage_put.c index f6db23b..908bc31 100644 --- a/src/libunixonacid/unixmessage_put.c +++ b/src/libunixonacid/unixmessage_put.c @@ -8,6 +8,7 @@ #include <skalibs/bitarray.h> #include <skalibs/bytestr.h> #include <skalibs/diuint.h> +#include <skalibs/error.h> #include <skalibs/stralloc.h> #include <skalibs/genalloc.h> #include <skalibs/siovec.h> @@ -49,6 +50,8 @@ static inline int copyfds (char *s, int const *fds, unsigned int n, unsigned cha static int reserve_and_copy (unixmessage_sender_t *b, unsigned int len, int const *fds, unsigned int nfds, unsigned char const *bits) { diuint cur = { .left = b->data.len, .right = b->fds.len } ; + if (len > UNIXMESSAGE_MAXSIZE || nfds > UNIXMESSAGE_MAXFDS) + return (errno = EPROTO, 0) ; if (!genalloc_readyplus(diuint, &b->offsets, 1) || !genalloc_readyplus(int, &b->fds, nfds) || !stralloc_readyplus(&b->data, len)) |