Skip to content

Optional undefined behavior of memcpy #350

@amgross

Description

@amgross

As described at #241 , it is undefined behavior to call memcpy with NULL pointer, even if length is 0.

{$indent}if (({$info.name} == NULL) && ({$info.sizeTemp} > 0))
{$indent}{
{$indent} codec->updateStatus(kErpcStatus_MemoryError);
{$indent}}
{$indent}else
{$indent}{
{$indent} memcpy({$info.name}, {$info.dataTemp}, {$info.sizeTemp});
{$indent}}

Here, if {$info.name} is NULL and {$info.sizeTemp} is 0 this undefined behavior will be reached.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions