Try to convince Coverity this string is terminated.

This commit is contained in:
Roger A. Light 2022-08-31 09:49:37 +01:00
parent 86fffa34a9
commit e22030bb2c
2 changed files with 2 additions and 2 deletions

View File

@ -180,9 +180,9 @@ int persist__chunk_msg_store_read_v234(FILE *db_fptr, struct P_msg_store *chunk,
log__printf(NULL, MOSQ_LOG_ERR, "Error: Out of memory."); log__printf(NULL, MOSQ_LOG_ERR, "Error: Out of memory.");
return MOSQ_ERR_NOMEM; return MOSQ_ERR_NOMEM;
} }
read_e(db_fptr, chunk->payload, chunk->F.payloadlen);
/* Ensure zero terminated regardless of contents */ /* Ensure zero terminated regardless of contents */
((uint8_t *)chunk->payload)[chunk->F.payloadlen] = 0; ((uint8_t *)chunk->payload)[chunk->F.payloadlen] = 0;
read_e(db_fptr, chunk->payload, chunk->F.payloadlen);
} }
return MOSQ_ERR_SUCCESS; return MOSQ_ERR_SUCCESS;

View File

@ -203,9 +203,9 @@ int persist__chunk_msg_store_read_v56(FILE *db_fptr, struct P_msg_store *chunk,
log__printf(NULL, MOSQ_LOG_ERR, "Error: Out of memory."); log__printf(NULL, MOSQ_LOG_ERR, "Error: Out of memory.");
return MOSQ_ERR_NOMEM; return MOSQ_ERR_NOMEM;
} }
read_e(db_fptr, chunk->payload, chunk->F.payloadlen);
/* Ensure zero terminated regardless of contents */ /* Ensure zero terminated regardless of contents */
((uint8_t *)chunk->payload)[chunk->F.payloadlen] = 0; ((uint8_t *)chunk->payload)[chunk->F.payloadlen] = 0;
read_e(db_fptr, chunk->payload, chunk->F.payloadlen);
} }
if(length > 0){ if(length > 0){