Skip to content

Commit

Permalink
pdu.c: Correctly check for NUL termination space when outputting bad …
Browse files Browse the repository at this point in the history
…options
  • Loading branch information
mrdeep1 committed Nov 22, 2022
1 parent 64de2ba commit 11018cc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pdu.c
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down

0 comments on commit 11018cc

Please sign in to comment.