Skip to content

Fix string length computation in iotjs::WrapEval #330

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

Merged
merged 1 commit into from
Mar 25, 2016

Conversation

akosthekiss
Copy link
Member

The iotjs::String constructor automatically allocates at least
size+1 bytes for the data (that +1 byte for the terminating zero),
so there is no need for the +1 on the caller side.

Moreover, strcpy can work just as fine as strcat in this case,
since caller knows where the first string ends, so there is no need
to make strcat figure that out.

IoT.js-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu

@akosthekiss
Copy link
Member Author

As motivated by @zherczeg in jerryscript-project/jerryscript#813

@LaszloLango
Copy link
Contributor

LGTM

1 similar comment
@zherczeg
Copy link
Member

LGTM

The iotjs::String constructor automatically allocates at least
size+1 bytes for the data (that +1 byte for the terminating zero),
so there is no need for the +1 on the caller side.

Moreover, strcpy can work just as fine as strcat in this case,
since caller knows where the first string ends, so there is no need
to make strcat figure that out.

IoT.js-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
@akosthekiss akosthekiss merged commit dfdc98d into jerryscript-project:master Mar 25, 2016
@akosthekiss akosthekiss deleted the wrapeval-lens branch March 25, 2016 10:19
pmarcinkiew pushed a commit to pmarcinkiew/iotjs that referenced this pull request Aug 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants