Skip to content

Fix: serialization terminating on Null characters#125

Closed
DrShIkIgAmy wants to merge 1 commit into
eProsima:masterfrom
DrShIkIgAmy:master
Closed

Fix: serialization terminating on Null characters#125
DrShIkIgAmy wants to merge 1 commit into
eProsima:masterfrom
DrShIkIgAmy:master

Conversation

@DrShIkIgAmy

Copy link
Copy Markdown

In serialize functions strlen is used. That makes impossible to serialize protobuf with null character in the messages. I propose to add function serialize(const char* string_t, int len).

@JLBuenoLopez

Copy link
Copy Markdown
Contributor

Hi @DrShIkIgAmy

Please read this comment. CDR specification clearly states that:

The string contents include a single terminating null character.

@richiprosima

Copy link
Copy Markdown
Contributor

Build status:

  • Linux Build Status
  • Linux aarch64Build Status
  • Mac Build Status
  • Windows Build Status

@kaerwar

kaerwar commented Jan 10, 2024

Copy link
Copy Markdown

Hi @DrShIkIgAmy

Please read this comment. CDR specification clearly states that:

The string contents include a single terminating null character.

Hi JLBuenoLopez-eProsima
I don't think he's trying to express the meaning of the terminator. I understand that if the real data that the string needs to pass is 0, then Cdr will ignore this real data, resulting in meaningless passing

@JLBuenoLopez

Copy link
Copy Markdown
Contributor

@kaerwar

Then do not use a string type as the CDR specification does not allow to send a null character within the string content because it is not possible to differentiate between that character being data or the terminator. You can always define a sequence of octets and within that sequence you might set any number of null characters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants