Azure / azure-c-shared-utility

Azure C SDKs common code
Other
111 stars 203 forks source link

crt_abstractions.c: fix error management in mallocAndStrcpy #545

Closed ODugas closed 3 years ago

ODugas commented 3 years ago

It can be demonstrated that the errno_t returned by strcpy_s (which is described as a regular int by the signature) can and will contain a positive error code. We therefore need to check for non-zero returned value instead of strictly negative integers.

danewalton commented 3 years ago

👍

From the docs here: https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2013/td1esda9(v=vs.120)

Zero if successful; otherwise, an error.

Do you mind updating and rebasing your changes?

ODugas commented 3 years ago

@ericwol-msft @danewalton I updated and rebased my changes. I'll stay nearby, but I believe this is all I need to do for you to merge this, right? Thanks a lot.

danewalton commented 3 years ago

/azp run

azure-pipelines[bot] commented 3 years ago
Azure Pipelines successfully started running 1 pipeline(s).
danewalton commented 3 years ago

@ODugas sorry about this are you able to do it once more (rebase master)? It says it's still out of date.