MQTTClient
Diff: MQTTClient.cpp
- Revision:
- 8:f7afec229461
- Parent:
- 7:c12d2bfe40e2
- Child:
- 9:a0e39cea763a
diff -r c12d2bfe40e2 -r f7afec229461 MQTTClient.cpp --- a/MQTTClient.cpp Wed Apr 04 20:59:13 2012 +0000 +++ b/MQTTClient.cpp Wed Apr 04 22:00:28 2012 +0000 @@ -131,7 +131,7 @@ var_header[9] |= (passwordLen > 0 ? 0x40 : 0x00 ); // printf("fixed %d, var %d id %d, username %d, password %d\n",sizeof(fixed_header), sizeof(var_header), sizeof(id), usernameLen, passwordLen ); - char packet[sizeof(fixed_header) + sizeof(var_header) + sizeof(id) + usernameLen + (usernameLen > 0 ? 2 : 0) + passwordLen + (passwordLen > 0 ? 2 : 0) ]; + char packet[sizeof(fixed_header) + sizeof(var_header) + sizeof(id) + 6 + usernameLen + (usernameLen > 0 ? 2 : 0) + passwordLen + (passwordLen > 0 ? 2 : 0) ]; memset(packet,0,sizeof(packet)); memcpy(packet,fixed_header,sizeof(fixed_header));