Skip to content

Commit

Permalink
error to warn
Browse files Browse the repository at this point in the history
  • Loading branch information
Xavrax committed Nov 22, 2023
1 parent 2a4aae1 commit bce16c9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/pubnub_ccore_pubsub.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ char const* pbcc_get_msg(struct pbcc_context* pb)
if (NULL != pb->crypto_module) {
char* trimmed = (char*)malloc(strlen(rslt) + 1); // same length as rslt
if (NULL == trimmed) {
PUBNUB_LOG_ERROR("pbcc_get_msg(pbcc=%p) - failed to allocate memory for trimmed string. Returning original message!\n", pb);
PUBNUB_LOG_WARNING("pbcc_get_msg(pbcc=%p) - failed to allocate memory for trimmed string. Returning original message!\n", pb);
return rslt;
}
sprintf(trimmed, "%s", rslt);
Expand All @@ -133,19 +133,19 @@ char const* pbcc_get_msg(struct pbcc_context* pb)
free(trimmed);

if (NULL == encrypted.ptr) {
PUBNUB_LOG_ERROR("pbcc_get_msg(pbcc=%p) - base64 decoding failed. Returning original message!\n", pb);
PUBNUB_LOG_WARNING("pbcc_get_msg(pbcc=%p) - base64 decoding failed. Returning original message!\n", pb);
return rslt;
}

pubnub_bymebl_t rslt_block = pb->crypto_module->decrypt(pb->crypto_module, encrypted);
free(encrypted.ptr);
if (NULL == rslt_block.ptr) {
PUBNUB_LOG_ERROR("pbcc_get_msg(pbcc=%p) - decryption failed. Returning original message!\n", pb);
PUBNUB_LOG_WARNING("pbcc_get_msg(pbcc=%p) - decryption failed. Returning original message!\n", pb);
return rslt;
}

if (pb->decrypted_message_count >= PUBNUB_MAX_DECRYPTED_MESSAGES) {
PUBNUB_LOG_ERROR("pbcc_get_msg(pbcc=%p) - maximum number of decrypted messages reached. Returning original message!\n", pb);
PUBNUB_LOG_WARNING("pbcc_get_msg(pbcc=%p) - maximum number of decrypted messages reached. Returning original message!\n", pb);
return rslt;
}

Expand Down

0 comments on commit bce16c9

Please sign in to comment.