fix max message length handling - exclude the header
[project/ubus.git] / ubusd.c
diff --git a/ubusd.c b/ubusd.c
index aa745504162f78c28494e349283864f7e4cbd25a..14eb537ca48fc504771276a3513c7ac36c1025e2 100644 (file)
--- a/ubusd.c
+++ b/ubusd.c
@@ -206,7 +206,7 @@ retry:
                if (cl->pending_msg_offset < sizeof(cl->hdrbuf))
                        goto out;
 
-               if (blob_len(&cl->hdrbuf.data) + sizeof(cl->hdrbuf) > UBUS_MAX_MSGLEN)
+               if (blob_pad_len(&cl->hdrbuf.data) > UBUS_MAX_MSGLEN)
                        goto disconnect;
 
                cl->pending_msg = ubus_msg_new(NULL, blob_raw_len(&cl->hdrbuf.data), false);