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

Adding NULL to ptr when codec function failed. #253

Conversation

Hadatko
Copy link
Member

@Hadatko Hadatko commented Feb 26, 2022

Signed-off-by: Cervenka Dusan cervenka@acrios.com

Signed-off-by: Cervenka Dusan <cervenka@acrios.com>
@Hadatko Hadatko self-assigned this Feb 26, 2022
@Hadatko Hadatko linked an issue Feb 26, 2022 that may be closed by this pull request
@amgross
Copy link
Contributor

amgross commented Feb 27, 2022

I suggest to add comment in the code explaining the reason behind putting value in the pointer, as it not trivial

@amgross
Copy link
Contributor

amgross commented Feb 27, 2022

I think you wrote the word 'in' twice by mistake " 0 can be valid value or in in case of error."
Anyway I thought we agreed in the issue discussion that this solution is not enough?

Signed-off-by: Cervenka Dusan <cervenka@acrios.com>
@Hadatko Hadatko force-pushed the bugfix/calling_memcpy_with_invalid_ptr branch from 422dfc0 to 0db4341 Compare February 27, 2022 22:29
@Hadatko
Copy link
Member Author

Hadatko commented Feb 27, 2022

HI @amgross , the last commit was related to your request with adding comment to code.
Final decision was not made related to memcpy. But as i said, i will likely add if condition.

@Hadatko
Copy link
Member Author

Hadatko commented Feb 27, 2022

@amgross what do you think about memcpy_s?

@amgross
Copy link
Contributor

amgross commented Feb 28, 2022

@Hadatko I think memcpy_s will solve the issue. unfortunately it seems from the documentations that not all compilers includes this function.
'As with all bounds-checked functions, memcpy_s is only guaranteed to be available if STDC_LIB_EXT1 is defined by the implementation'

Signed-off-by: Cervenka Dusan <cervenka@acrios.com>
@Hadatko Hadatko added this to the 1.9.1 milestone Feb 28, 2022
@Hadatko Hadatko added the bug label Feb 28, 2022
@Hadatko
Copy link
Member Author

Hadatko commented Mar 1, 2022

@amgross Thank you for your collaboration.

@MichalPrincNXP likely ready.

@MichalPrincNXP MichalPrincNXP merged commit 5a4ab2a into EmbeddedRPC:develop Mar 10, 2022
@MichalPrincNXP
Copy link
Member

Thank you for the effort!

@Hadatko Hadatko deleted the bugfix/calling_memcpy_with_invalid_ptr branch March 21, 2022 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

Calling memcpy with invalid pointer
3 participants