Skip to content

Commit

Permalink
Merge branch 'master' into fix/missing-if-macros
Browse files Browse the repository at this point in the history
  • Loading branch information
Xavrax committed Dec 7, 2023
2 parents f9a1a06 + 3f322aa commit 841b72d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
21 changes: 13 additions & 8 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
name: c-core
schema: 1
version: "4.7.0"
version: "4.7.1"
scm: github.com/pubnub/c-core
changelog:
- date: 2023-11-23
version: v4.7.1
changes:
- type: bug
text: "Handle unencrypted message while getting messages with crypto."
- date: 2023-11-20
version: v4.7.0
changes:
Expand Down Expand Up @@ -763,7 +768,7 @@ sdks:
distribution-type: source code
distribution-repository: GitHub release
package-name: C-Core
location: https://github.com/pubnub/c-core/releases/tag/v4.7.0
location: https://github.com/pubnub/c-core/releases/tag/v4.7.1
requires:
-
name: "miniz"
Expand Down Expand Up @@ -829,7 +834,7 @@ sdks:
distribution-type: source code
distribution-repository: GitHub release
package-name: C-Core
location: https://github.com/pubnub/c-core/releases/tag/v4.7.0
location: https://github.com/pubnub/c-core/releases/tag/v4.7.1
requires:
-
name: "miniz"
Expand Down Expand Up @@ -895,7 +900,7 @@ sdks:
distribution-type: source code
distribution-repository: GitHub release
package-name: C-Core
location: https://github.com/pubnub/c-core/releases/tag/v4.7.0
location: https://github.com/pubnub/c-core/releases/tag/v4.7.1
requires:
-
name: "miniz"
Expand Down Expand Up @@ -957,7 +962,7 @@ sdks:
distribution-type: source code
distribution-repository: GitHub release
package-name: C-Core
location: https://github.com/pubnub/c-core/releases/tag/v4.7.0
location: https://github.com/pubnub/c-core/releases/tag/v4.7.1
requires:
-
name: "miniz"
Expand Down Expand Up @@ -1018,7 +1023,7 @@ sdks:
distribution-type: source code
distribution-repository: GitHub release
package-name: C-Core
location: https://github.com/pubnub/c-core/releases/tag/v4.7.0
location: https://github.com/pubnub/c-core/releases/tag/v4.7.1
requires:
-
name: "miniz"
Expand Down Expand Up @@ -1074,7 +1079,7 @@ sdks:
distribution-type: source code
distribution-repository: GitHub release
package-name: C-Core
location: https://github.com/pubnub/c-core/releases/tag/v4.7.0
location: https://github.com/pubnub/c-core/releases/tag/v4.7.1
requires:
-
name: "miniz"
Expand Down Expand Up @@ -1127,7 +1132,7 @@ sdks:
distribution-type: source code
distribution-repository: GitHub release
package-name: C-Core
location: https://github.com/pubnub/c-core/releases/tag/v4.7.0
location: https://github.com/pubnub/c-core/releases/tag/v4.7.1
requires:
-
name: "miniz"
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v4.7.1
November 23 2023

#### Fixed
- Handle unencrypted message while getting messages with crypto.

## v4.7.0
November 20 2023

Expand Down
12 changes: 6 additions & 6 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. Dropping message!\n", pb);
PUBNUB_LOG_ERROR("pbcc_get_msg(pbcc=%p) - failed to allocate memory for trimmed string. Returning original message!\n", pb);
return NULL;
}
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. Dropping message!\n", pb);
return NULL;
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. Dropping message!\n", pb);
return NULL;
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. Dropping message!\n", pb);
PUBNUB_LOG_ERROR("pbcc_get_msg(pbcc=%p) - maximum number of decrypted messages reached. Returning original message!\n", pb);
return NULL;
}

Expand Down
2 changes: 1 addition & 1 deletion core/pubnub_version_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#define INC_PUBNUB_VERSION_INTERNAL


#define PUBNUB_SDK_VERSION "4.7.0"
#define PUBNUB_SDK_VERSION "4.7.1"


#endif /* !defined INC_PUBNUB_VERSION_INTERNAL */

0 comments on commit 841b72d

Please sign in to comment.