Skip to content

Commit

Permalink
[ICU-4490] fix buffer overflow
Browse files Browse the repository at this point in the history
X-SVN-Rev: 17562
  • Loading branch information
ramv committed May 5, 2005
1 parent 3802a93 commit b43daa9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion idnbrowser/idnbrwsr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ printToUnicode (const UChar *s, int32_t length, UBool &printUnassignedError, UBo

static void
printToUnicode (const UChar *s, int32_t length) {
UChar *output = (UChar*) malloc(U_SIZEOF_UCHAR * length);
UChar *output = NULL;
int32_t tempOutLen = length * 9;
UChar *tempOut = (UChar*) malloc(U_SIZEOF_UCHAR * tempOutLen) ;
int32_t outputLength;
Expand All @@ -403,6 +403,9 @@ printToUnicode (const UChar *s, int32_t length) {
errorCode=U_ZERO_ERROR;
tempOutLen = uidna_IDNToASCII(s,length,tempOut, tempOutLen, UIDNA_ALLOW_UNASSIGNED, &parseError, &errorCode);

length = tempOutLen * 9;
output = (UChar*) malloc(U_SIZEOF_UCHAR * length);

outputLength= uidna_IDNToUnicode(tempOut, tempOutLen, output, length,UIDNA_ALLOW_UNASSIGNED, &parseError, &errorCode);

if(U_FAILURE(errorCode)) {
Expand Down

0 comments on commit b43daa9

Please sign in to comment.