--- libaitmqtt/src/conn.c 2012/06/20 15:02:24 1.2 +++ libaitmqtt/src/conn.c 2012/06/28 11:06:17 1.3 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: conn.c,v 1.2 2012/06/20 15:02:24 misho Exp $ +* $Id: conn.c,v 1.3 2012/06/28 11:06:17 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -68,7 +68,7 @@ mqtt_msgCONNECT(mqtt_msg_t * __restrict buf, const cha u_char ClrSess, u_char WillQOS, u_char WillRetain) { int len, siz = 0; - u_int n; + u_int n, *l; struct mqtthdr *hdr; mqtthdr_var_t *var, *cid, *topic, *wmsg, *user, *pass; mqtthdr_protover_t *proto; @@ -123,7 +123,8 @@ mqtt_msgCONNECT(mqtt_msg_t * __restrict buf, const cha /* fixed header */ MQTTHDR_MSGINIT(hdr); hdr->mqtt_msg.type = MQTT_TYPE_CONNECT; - *(u_int*) hdr->mqtt_len = n; + l = (u_int*) hdr->mqtt_len; + *l = n; data += siz; /* variable header */