mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-20 22:39:05 +03:00
block.h: Make COAP_OPT_BLOCK_* functions safe against NULL indirects
COAP_OPT_BLOCK_LAST(opt) may return NULL, so doing *COAP_OPT_BLOCK_LAST(opt) is unsafe. Replace indirect with COAP_OPT_BLOCK_END_BYTE(opt).
This commit is contained in:
1 parent
4ef0705ccd
commit
dbf78b526f
2 files changed
+8
-3
No files matched your search
+1
-1
@@ -39,7 +39,7 @@ coap_opt_block_num(const coap_opt_t *block_opt) {
|
||||
coap_opt_length(block_opt) - 1);
|
||||
}
|
||||
|
||||
return (num << 4) | ((*COAP_OPT_BLOCK_LAST(block_opt) & 0xF0) >> 4);
|
||||
return (num << 4) | ((COAP_OPT_BLOCK_END_BYTE(block_opt) & 0xF0) >> 4);
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
Reference in new issue
Block a user