Skip to content

Commit d83cbb8

Browse files
committed
NFC-Text: fix passing null pointer to a function.
Fixes Coverity issue about passing nullptr to memcpy.
1 parent 081183c commit d83cbb8

File tree

1 file changed

+3
-1
lines changed
  • features/nfc/source/nfc/ndef/common

1 file changed

+3
-1
lines changed

features/nfc/source/nfc/ndef/common/Text.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ Text::Text(const Text &other) :
4141
_text_record(other._text_record ? new uint8_t[other._text_record_size] : NULL),
4242
_text_record_size(other._text_record_size)
4343
{
44-
memcpy(_text_record, other._text_record, _text_record_size);
44+
if (_text_record) {
45+
memcpy(_text_record, other._text_record, _text_record_size);
46+
}
4547
}
4648

4749
Text::Text(

0 commit comments

Comments
 (0)