option.c: fixed off-by-one error in Uri-Query encoder
option.c: fixed off-by-one error in Uri-Query encoder

This modification fixes a bug in coap_opt_setheader() that could
have caused the function's return value to be larger than the
value passed as buffer size. As this function is called by
make_decoded_option() in uri.c, the subsequent assert() will fire
in that case. The bug occurred in the rare case that the contents
of a query option were longer 13 bytes and the buffer was smaller
than the number of bytes that were needed to encode the content
length.

This bug has been reported by Oscar Novo.

authmillenon/libcoap,authmillenon/libcoap,gebart/libcoap,gebart/libcoap,authmillenon/libcoap,gebart/libcoap