mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-09 02:32:53 +03:00
bugfix in option length encoding (pointed out by Timm Decker)
This commit is contained in:
1 parent
d9eb6dc70e
commit
9f31ab3212
2 files changed
+6
-5
No files matched your search
+1
-1
@@ -7,7 +7,7 @@
|
||||
# README for terms of use.
|
||||
|
||||
AC_PREREQ([2.65])
|
||||
AC_INIT([libcoap], [3.0.0])
|
||||
AC_INIT([libcoap], [3.0.1])
|
||||
AC_CONFIG_SRCDIR([coap.h])
|
||||
|
||||
# First check for Contiki build to quit configure before any other test
|
||||
|
||||
@@ -184,7 +184,7 @@ coap_opt_value(coap_opt_t *opt) {
|
||||
while (*++p == 0xff && n++ < 3)
|
||||
;
|
||||
|
||||
return p;
|
||||
return ++p; /* point to next byte after length indicator */
|
||||
}
|
||||
|
||||
size_t
|
||||
@@ -221,9 +221,10 @@ coap_opt_setlength(coap_opt_t *opt, size_t maxlen, size_t length) {
|
||||
if (maxlen <= res)
|
||||
return 0;
|
||||
|
||||
opt++;
|
||||
memset(opt, 0xff, res);
|
||||
*opt = length & 0xff;
|
||||
memset(opt, 0xff, res-1);
|
||||
opt[res] = length & 0xff;
|
||||
|
||||
++res;
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
Reference in new issue
Block a user