Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-2016

Memory corruption occurs in _itow_s()

    XMLWordPrintable

    Details

    • Type: Incident report
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.9.0 (alpha)
    • Fix Version/s: 1.8.2, 1.9.0 (alpha)
    • Component/s: Agent (G)
    • Labels:
      None
    • Environment:
      Windows, Zabbix Agent 1.9 (r10124)

      Description

      The 3rd argument of _itow_s() must be not size of counting byte but size of counting character.
      When I compile with "define UNICODE", memory corruption occurs in _itow_s().
      http://msdn.microsoft.com/en-us/library/0we9x30h(VS.80).aspx

      Zabbix using _itow_s() in following code.

      trunk/src/zabbix_agent/cpustat.c:76 in "init_cpu_collector()"
      > for(i = 0 /* 0 : _Total; >0 : cpu */; i <= pcpus->count; i++) {
      > if (i == 0)
      > zbx_wsnprintf(cpu, sizeof(cpu), TEXT("_Total"));
      > else
      > _itow_s(i - 1, cpu, sizeof(cpu), 10);

      I think it should be following.

      trunk/src/zabbix_agent/cpustat.c:76 in "init_cpu_collector()"
      > for(i = 0 /* 0 : _Total; >0 : cpu */; i <= pcpus->count; i++) {
      > if (i == 0)
      > zbx_wsnprintf(cpu, sizeof(cpu), TEXT("_Total"));
      > else
      > _itow_s(i - 1, cpu, sizeof(cpu)/sizeof(TCHAR), 10);

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            tsuzuki Takanori Suzuki
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: