diff --git a/.github/workflows/cifuzz.yml b/.github/workflows/cifuzz.yml index e9409c73..016e78d6 100644 --- a/.github/workflows/cifuzz.yml +++ b/.github/workflows/cifuzz.yml @@ -27,7 +27,7 @@ jobs: dry-run: false language: c++ - name: Upload Crash - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() && steps.build.outcome == 'success' with: name: artifacts diff --git a/src/coap_pdu.c b/src/coap_pdu.c index 3b056ef5..f1f81e06 100644 --- a/src/coap_pdu.c +++ b/src/coap_pdu.c @@ -1279,8 +1279,8 @@ write_char(char **obp, size_t *len, int c, int printable) { int coap_pdu_parse_opt(coap_pdu_t *pdu) { - int good = 1; + /* sanity checks */ if (pdu->code == 0) { if (pdu->used_size != 0 || pdu->e_token_length) { @@ -1350,7 +1350,10 @@ coap_pdu_parse_opt(coap_pdu_t *pdu) { outbuflen = sizeof(outbuf); obp = outbuf; ok = write_prefix(&obp, &outbuflen, "O: ", 3); - while (ok && length > 0 && *opt != COAP_PAYLOAD_START) { + /* + * Not safe to check for 'ok' here as a lot of variables may get + * partially changed due to lack of outbuflen */ + while (length > 0 && *opt != COAP_PAYLOAD_START) { coap_opt_t *opt_last = opt; size_t optsize = next_option_safe(&opt, &length, &pdu->max_opt); const uint32_t len =