Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMQPMessage::setMessage error #49

Open
alexswyt opened this issue Sep 14, 2016 · 1 comment
Open

AMQPMessage::setMessage error #49

alexswyt opened this issue Sep 14, 2016 · 1 comment

Comments

@alexswyt
Copy link

alexswyt commented Sep 14, 2016

Hi!
Have a simple error while processed Message body (AMQPMessage::setMessage).
At start & if length this->data > length you have undefined stay \0 in the this->data (corrupt body).

Instead :
line 30:
this->data = (char*)malloc(length);
memcpy(this->data,data,length);

I offer:
this->data = (char*)malloc(length+1);
this->data[length]='\0';
if (!this->data) {
throw AMQPException("cannot alocate memory for data");
}
strncpy(this->data,data,length);

wbr,
buy.

@akalend
Copy link
Owner

akalend commented Sep 14, 2016

thanks

bumbar1 added a commit to bumbar1/amqpcpp that referenced this issue Oct 7, 2016
akalend added a commit that referenced this issue Oct 7, 2016
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

No branches or pull requests

2 participants