Contents of the envelope->payload var in the basic_frame_reception sample

Hello team,

I’m using the sampe called basic_frame_reception to learn programmation with XBees.
When a message is received by the device, it is printed on the serial port.

The message (the payload) is printed by a dump of envelope->payload:

dump(envelope->payload, envelope->length);

(envelope->length = 6)

For example, if the message is “CANADA”, “CANADA” will be printed on my serial port.

But if I copy envelope->payload into an other var and I print it, the output will be “CANADAA”.

strcpy(test,envelope->payload);
	printf("Var test '%s'
",test);

I tried with several messages and there is always an added character at the end of my message.

How can you explain this behaviour ?

The aim is to use the message (the correct one) after.

Thanks in advance

Todd, where are you finding this sample code “basic_frame_reception”? It would help to know so we have a better idea as to where this question is coming from.