Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit c536fcc

Browse files
committed
[CID 15463] libcore: MCCStringFromUnicode(): Dereference after null check
1 parent 3abda9d commit c536fcc

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

libcore/src/core.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -632,11 +632,14 @@ bool MCCStringToUnicode(const char *p_string, unichar_t*& r_unicode_string)
632632

633633
bool MCCStringFromUnicode(const unichar_t *p_unicode_string, char*& r_string)
634634
{
635+
if (NULL == p_unicode_string)
636+
return false;
637+
635638
uint32_t t_wstring_length;
636639
t_wstring_length = 0;
637-
if (p_unicode_string != nil)
638-
while(p_unicode_string[t_wstring_length] != 0)
639-
t_wstring_length++;
640+
641+
while(p_unicode_string[t_wstring_length] != 0)
642+
t_wstring_length++;
640643

641644
return MCCStringFromUnicodeSubstring(p_unicode_string, t_wstring_length, r_string);
642645
}

0 commit comments

Comments
 (0)