Bug 14919 - Unsafe returned value of NULL pointer in function _nl_normalize_codeset at file intl/l10nflist.c
Summary: Unsafe returned value of NULL pointer in function _nl_normalize_codeset at fi...
Status: NEW
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.23
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-05 08:16 UTC by yangyeping
Modified: 2012-12-05 08:21 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description yangyeping 2012-12-05 08:16:50 UTC
Sorry,I can't find a suitable component for this bug, and I select binutils.
1)The file path containing this vulnerability: intl/l10nflist.c
2)Line number: 433
3)Code fragment (from line 415 to line 433):

 retval = (char *) malloc ((only_digit ? 3 : 0) + len + 1); 

  if (retval != NULL)
    {   
      if (only_digit)
        wp = stpcpy (retval, "iso");
      else
        wp = retval;

      for (cnt = 0; cnt < name_len; ++cnt)
        if (isalpha ((unsigned char) codeset[cnt]))
          *wp++ = tolower ((unsigned char) codeset[cnt]);
        else if (isdigit ((unsigned char) codeset[cnt]))
          *wp++ = codeset[cnt];

      *wp = '\0';
    }   

  return (const char *) retval;

4) Short description: The variable "retval" is assigned at line 415 via function
"malloc". Although it is  sanity-checked, this function can still return a NULL pointer if retval is NULL.The "_nl_normalize_codeset" function is called at line 
115 "*normali zed_codeset = _nl_normalize_codeset (*codeset,cp - *codeset);" in file intl/explodename.c. If variable normalized_codeset is null, then the following strcmp function will have a NULL pointer argument and a NULL pointer dereference vulnerability occur
Comment 1 yangyeping 2012-12-05 08:21:16 UTC
The Version is the newest 2.23.1,but I can't find it in the the Version list.