mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-26 00:41:42 +03:00
Coverity: Fix reported errors
CID 1667634 CID 1667636 CID 1667638 CID 1667639 CID 1667641 CID 1667642 CID 1667644 CID 1667646 CID 1667647 CID 1667649 CID 1667650 CID 1667651
This commit is contained in:
1 parent
43bb86df92
commit
bcee6f7149
7 files changed
+37
-15
No files matched your search
@@ -47,6 +47,9 @@ unsigned int
|
||||
coap_encode_var_safe(uint8_t *buf, size_t length, unsigned int val) {
|
||||
unsigned int n, i;
|
||||
|
||||
if (val == 0)
|
||||
return 0;
|
||||
|
||||
for (n = 0, i = val; i && n < sizeof(val); ++n)
|
||||
i >>= 8;
|
||||
|
||||
@@ -78,6 +81,9 @@ coap_encode_var_safe8(uint8_t *buf, size_t length, uint64_t val) {
|
||||
unsigned int n, i;
|
||||
uint64_t tval = val;
|
||||
|
||||
if (val == 0)
|
||||
return 0;
|
||||
|
||||
for (n = 0; tval && n < sizeof(val); ++n)
|
||||
tval >>= 8;
|
||||
|
||||
|
||||
Reference in new issue
Block a user