Coverity: Fix scan issues

Fixes

CID 1502435:
CID 1502432:
CID 1502423:

False Positives

CID 1502434:  Cant see why code is not reached
CID 1502433:  Could make blk_size uint8_t:3 I guess.
CID 1502430:  Dont know why it is complaining
CID 1502427:
CID 1502426:  Code looks fine to me - context->session could be set.
CID 1502424:

Fixed by other PRs

CID 1502422: #610
CID 1502431: #610
CID 1502428: #610
CID 1502429: #587 with my additional fixes
This commit is contained in:
Jon Shallow committed 2021-03-17 11:17:18 +00:00
1 parent ae752e9e7a
commit 74342abe4d
4 files changed
+9 -3

No files matched your search

+1
View File
@@ -1146,6 +1146,7 @@ hnd_proxy_uri(coap_context_t *ctx COAP_UNUSED,
if (token && !coap_add_token(pdu, token->length, token->s)) {
coap_log(LOG_DEBUG, "cannot add token to proxy request\n");
response->code = COAP_RESPONSE_CODE_INTERNAL_ERROR;
coap_delete_pdu(pdu);
goto cleanup;
}
+2 -2
View File
@@ -300,9 +300,9 @@ coap_cancel_observe(coap_session_t *session, coap_binary_t *token,
LL_FOREACH(session->lg_crcv, cq) {
if (cq->observe_set) {
if ((!token && !cq->app_token->length) ||
if ((!token && !cq->app_token->length) || (token &&
full_match(token->s, token->length, cq->app_token->s,
cq->app_token->length)) {
cq->app_token->length))) {
uint8_t buf[4];
coap_tid_t mid;
coap_pdu_t * pdu = coap_pdu_duplicate(&cq->pdu,
+5 -1
View File
@@ -140,7 +140,11 @@ coap_new_cache_entry(coap_session_t *session, const coap_pdu_t *pdu,
if (record_pdu == COAP_CACHE_RECORD_PDU) {
entry->pdu = coap_pdu_init(pdu->type, pdu->code, pdu->tid, pdu->alloc_size);
if (entry->pdu) {
coap_pdu_resize(entry->pdu, pdu->alloc_size);
if (!coap_pdu_resize(entry->pdu, pdu->alloc_size)) {
coap_delete_pdu(entry->pdu);
coap_free_type(COAP_CACHE_ENTRY, entry);
return NULL;
}
/* Need to get the appropriate data across */
memcpy(entry->pdu, pdu, offsetof(coap_pdu_t, token));
memcpy(entry->pdu->token, pdu->token, pdu->used_size);
+1
View File
@@ -526,6 +526,7 @@ coap_show_pdu(coap_log_t level, const coap_pdu_t *pdu) {
outbuflen = strlen(outbuf);
snprintf(&outbuf[outbuflen], sizeof(outbuf)-outbuflen, " [");
while ((option = coap_option_next(&opt_iter))) {
buf[0] = '\000';
if (!have_options) {
have_options = 1;
} else {