mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-15 12:44:55 +03:00
pdu.c: Correctly check for NUL termination space when outputting bad options
This commit is contained in:
1 parent
64de2ba4ea
commit
11018cc34c
1 file changed
+2
-2
@@ -1014,7 +1014,7 @@ coap_pdu_parse_opt_base(coap_pdu_t *pdu, uint16_t len) {
|
||||
static int
|
||||
write_prefix(char **obp, size_t *len, const char *prf, size_t prflen) {
|
||||
/* Make sure space for null terminating byte */
|
||||
if (*len > prflen +1) {
|
||||
if (*len < prflen +1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1027,7 +1027,7 @@ write_prefix(char **obp, size_t *len, const char *prf, size_t prflen) {
|
||||
static int
|
||||
write_char(char **obp, size_t *len, char c, int printable) {
|
||||
/* Make sure space for null terminating byte */
|
||||
if (*len > 3) {
|
||||
if (*len < 2 +1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user