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

Memory corruption occurs in _itow_s()

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Fixed
    • Icon: Major Major
    • 1.8.2, 1.9.0 (alpha)
    • 1.9.0 (alpha)
    • Agent (G)
    • None
    • Windows, Zabbix Agent 1.9 (r10124)

      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);

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

              Created:
              Updated:
              Resolved: