gillesDD / jcoap

Automatically exported from code.google.com/p/jcoap
0 stars 0 forks source link

Option length field miscalculation of 15 #3

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

According to the draft-coap-7 the optional length is split in length lower then 
15 or hight for the next length field.

so,

length < 15 then the long length is 0,
but when the length > 15 then the over flowing length is placed into the long 
length value - 15.

example:
 total length = 17.
 results into short length = 15, long length = 2

in the current implementation of jcoap this substraction isn't done.

bugfix can be done in the file CoapHeaderOptions function deserialize, line 78
tmpLength = tmp.getLongLength() + 15;

end for serialization :

CoapHeaderOption
line 37,  longLength = value.length-15;

regards,

Original issue reported on code.google.com by lieke...@gmail.com on 7 Oct 2011 at 11:21

GoogleCodeExporter commented 9 years ago
The issue is still present since the length in the latest standard is actually 
13 and not 15. The fix is easy.

Original comment by fmletti...@gmail.com on 13 May 2015 at 2:59