Examples of errors detected by the V576 diagnostic

<< Return to list of all diagnostics

V576. Incorrect format. Consider checking the N actual argument of the 'Foo' function.


Energy Checker SDK

V576 Incorrect format. Consider checking the second actual argument of the 'wprintf' function. The pointer to string of wchar_t type symbols is expected. producer producer.c 166


int main(void) {
  ...
  char *p = NULL;
  ...
  wprintf(
    _T("Using power link directory: %s\n"),
    p
  );
  ...
}

You should either use printf() or convert p.


Energy Checker SDK

V576 Incorrect format. A different number of actual arguments is expected while calling 'printf' function. Expected: 2. Present: 3. uuid_variant_sample uuid_variant_sample.c 259


int main(void) {
  ...
  printf(
    "Attach to [%s] Has Failed Possibly Because of"
    " a platform UUID variant.\n",
    pl_config_file_name,
    pld
  );
  ...
}

Should either add "%i" or remove the "pld" argument.


Intel AMT SDK

V576 Incorrect format. A different number of actual arguments is expected while calling 'printf' function. Expected: 1. Present: 2. Discovery discoverysample.cpp 168


bool ParseArgs(int argc, char **argv)
{
  ...
  printf("\nMust specify a file name when using '-report'.\n",
         argv[currArg++]);
  ...
}

Intel AMT SDK

V576 Incorrect format. A different number of actual arguments is expected while calling 'printf' function. Expected: 1. Present: 2. RemoteControlSample remotecontrolsample.cpp 792


bool GetUserValues(....)
{
  ...
  printf("Error: illegal value. Aborting.\n", tmp);
  return false;
}

Intel AMT SDK

V576 Incorrect format. A different number of actual arguments is expected while calling 'sprintf' function. Expected: 9. Present: 10. ConfigurationServer configurationutils.cpp 236


void StringFromPPS(....)
{
  ...
  sprintf((char *)textPPS,
    "%04X-%04X-%04X-04X-%04X-%04X-%04X-%04X\0",
    *(unsigned long *) (hexString),
    *(unsigned short *)(hexString+4),
    *(unsigned short *)(hexString+4+4),
    *(unsigned short *)(hexString+4+4+4),
    *(unsigned short *)(hexString+4+4+4+4),
    *(unsigned short *)(hexString+4+4+4+4+4),
    *(unsigned short *)(hexString+4+4+4+4+4+4),
    *(unsigned short *)(hexString+4+4+4+4+4+4+4)
    );
  ...
}

One of the arguments is 04X instead of %04X.


Intel AMT SDK

V576 Incorrect format. A different number of actual arguments is expected while calling 'fprintf' function. Expected: 2. Present: 3. USBFile usbfile.cpp 489


int WriteXmlFile(....)
{
  ...
  fprintf(fp, "</pps>\n", r.Pps);
  ...
}

Intel AMT SDK

V576 Incorrect format. A different number of actual arguments is expected while calling '_snprintf' function. Expected: 18. Present: 19. mod_pvs mod_pvs.cpp 308


void addAttribute(....)
{
  ...
  int index = _snprintf(temp, 1023,
    "%02x%02x:%02x%02x:%02x%02x:%02x%02x:"
    "%02x%02x:02x%02x:%02x%02x:%02x%02x",
    value[0],value[1],value[2],value[3],value[4],
    value[5],value[6],value[7],value[8],
    value[9],value[10],value[11],value[12],
    value[13],value[14],value[15]);
  ...
}

One of the arguments is 02X instead of %02X.


Far Manager

V576 Incorrect format. Consider checking the third actual argument of the 'fwprintf' function. The argument is expected to be not greater than 32-bit. far syslog.cpp 1943


struct PanelViewSettings
{
  unsigned __int64 ColumnType[PANEL_COLUMNCOUNT];
  ...
};

void PanelViewSettings_Dump(....)
{
  ...
  fwprintf(fp,L"%d, ",ViewSettings.ColumnType[I]);
  ...
}

It works due to sheer luck (the function has only one argument). But you'd better fix it.

Identical errors can be found in some other places:

  • V576 Incorrect format. Consider checking the third actual argument of the 'fwprintf' function. The argument is expected to be not greater than 32-bit. far syslog.cpp 1945
  • V576 Incorrect format. Consider checking the third actual argument of the 'fwprintf' function. The argument is expected to be not greater than 32-bit. far syslog.cpp 1956
  • V576 Incorrect format. Consider checking the third actual argument of the 'fwprintf' function. The argument is expected to be not greater than 32-bit. far syslog.cpp 1958

ReactOS

V576 Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The char type argument is expected. regedit regproc.c 293


static void REGPROC_unescape_string(WCHAR* str)
{
  ...
  default:
    fprintf(stderr,
      "Warning! Unrecognized escape sequence: \\%c'\n",
      str[str_idx]);
  ...
}

%C should be used here.

Identical errors can be found in some other places:

  • V576 Incorrect format. Consider checking the fourth actual argument of the 'fprintf' function. The char type argument is expected. regedit regedit.c 234
  • V576 Incorrect format. Consider checking the fourth actual argument of the 'fprintf' function. The char type argument is expected. regedit regedit.c 230

ReactOS

V576 Incorrect format. Consider checking the second actual argument of the 'wprintf' function. The argument is expected to be not greater than 32-bit. dwnl dwnl.c 229


static HRESULT STDMETHODCALLTYPE
CBindStatusCallback_OnProgress(....)
{
  ...
  if (This->szMimeType[0] != _T('\0'))
    _tprintf(_T("Length: %I64u [%s]\n"),
      This->Size, This->szMimeType);
  else
    _tprintf(_T("Length: %ull\n"), This->Size);
  ...
}

%I64u should be used as well in the second case: _tprintf(_T("Length: %I64u\n"), This->Size);


Doom 3

V576 Incorrect format. A different number of actual arguments is expected while calling 'sprintf' function. Expected: 7. Present: 8. Game syscvar.cpp 54


struct gameVersion_s {
  gameVersion_s( void )
  {
    sprintf(string, "%s.%d%s %s %s",
            ENGINE_VERSION, BUILD_NUMBER, BUILD_DEBUG,
            BUILD_STRING, __DATE__, __TIME__ );
  }
  char string[256];
} gameVersion;

Mozilla Firefox

V576 Incorrect format. Consider checking the third actual argument of the 'fwprintf' function. The pointer to string of wchar_t type symbols is expected. cairo-win32-surface.c 129


cairo_status_t
_cairo_win32_print_gdi_error (const char *context)
{
  ...
  fwprintf (stderr, L"%s: %S", context, (wchar_t *)lpMsgBuf);
  ...
}

This is what should be written: fwprintf (stderr, L"%S: %S", context, (wchar_t *)lpMsgBuf);


PeerBlock

V576 Incorrect format. Consider checking the fourth actual argument of the 'swprintf_s' function. The pointer to string of wchar_t type symbols is expected. peerblock pb.cpp 153


#define PB_BLDSTR "PeerBlock " STRINGIFY(PB_VER_MAJOR) "." \
        STRINGIFY(PB_VER_MINOR) "+" " (r" \
        STRINGIFY(PB_VER_BUILDNUM) ") - DEV BUILD"

int WINAPI _tWinMain(....)
{
  ...
  TCHAR buf[64];
  swprintf_s(buf, sizeof(buf)/2, L"%S", PB_BLDSTR);
  ...
}

Identical errors can be found in some other places:

  • V576 Incorrect format. Consider checking the fourth actual argument of the 'swprintf_s' function. The pointer to string of wchar_t type symbols is expected. peerblock pb.cpp 232
  • V576 Incorrect format. Consider checking the fourth actual argument of the 'swprintf_s' function. The pointer to string of wchar_t type symbols is expected. peerblock updatelists.cpp 314
  • V576 Incorrect format. Consider checking the fourth actual argument of the 'swprintf_s' function. The pointer to string of wchar_t type symbols is expected. peerblock updatelists.cpp 318

DeSmuME

V576 Incorrect format. Consider checking the second actual argument of the 'printf' function. To print the value of pointer the '%p' should be used. DeSmuME_VS2005 debug.cpp 224


void DEBUG_reset()
{
  ...
  //force a reference to this function
  printf("DEBUG_reset: %08X\n",&DebugStatistics::print);
  ...
}

Identical errors can be found in some other places:

  • V576 Incorrect format. Consider checking the fifth actual argument of the 'sprintf' function. To print the value of pointer the '%p' should be used. DeSmuME_VS2005 lua-engine.cpp 2216

ffdshow

V576 Incorrect format. A different number of actual arguments is expected while calling 'swprintf' function. Expected: 4. Present: 5. tffdshowdecvideo.cpp 2271


void TffdshowDecVideo::getChapters(void)
{
  ....
  tsprintf(time_str, _l("%02i:%02i:%02"), hh, mm, ss);
  ....
}

CamStudio

V576 Incorrect format. A different number of actual arguments is expected while calling 'fprintf' function. Expected: 2. Present: 3. playplusview.cpp 7157


// Produces a 100% Valid XHTML Strict document to display
// the flash file, which works in all browsers (even IE 4)
void produceFlashHTML(CString htmlfilename,
  CString flashfilename, CString flashfilepath,
  int onlyflashtag, int width, int height,int bk_red,
  int bk_green, int bk_blue)
{
  ....
  fprintf(htmlfile, "<title>%s</title>\n",
    LPCTSTR(flashfilename));
  fprintf(htmlfile, "<style type=\"text/css\">\n");
  fprintf(htmlfile, "#movie\n{\n",
    LPCTSTR(flashfilename)); //<<<
  fprintf(htmlfile, "\twidth: %dpx;\n", width);
  fprintf(htmlfile, "\theight: %dpx;\n", height);
  ...
}

I like the comment. How sure the author is! :)


ReactOS

V576 Incorrect format. Consider checking the second actual argument of the 'wprintf' function. The argument is expected to be not greater than 32-bit. dwnl.c 228


UINT64 Size;

static HRESULT STDMETHODCALLTYPE
CBindStatusCallback_OnProgress(....)
{
  ....
  _tprintf(_T("Length: %ull\n"), This->Size);
  ....
}

This is what should be written: _tprintf(_T("Length: %llu\n"), This->Size);


ReactOS

V576 Incorrect format. Consider checking the third actual argument of the 'swprintf' function. To print the value of pointer the '%p' should be used. dialogs.cpp 66


BOOL CALLBACK EnumPickIconResourceProc(HMODULE hModule,
    LPCWSTR lpszType,
    LPWSTR lpszName,
    LONG_PTR lParam
)
{
  ....
  swprintf(szName, L"%u", lpszName);
  ....
}

ReactOS

V576 Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The char type argument is expected. msiexec.c 655


int WINAPI WinMain(....)
{
  LPWSTR *argvW = NULL;
  ....
  fprintf(stderr,
    "Unknown option \"%c\" in Repair mode\n", argvW[i][j]);
  ....
}

Identical errors can be found in some other places:

  • V576 Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The char type argument is expected. msiexec.c 705
  • V576 Incorrect format. Consider checking the third actual argument of the 'swprintf' function. The pointer to string of wchar_t type symbols is expected. sminit.c 1831
  • V576 Incorrect format. Consider checking the third actual argument of the 'swprintf' function. The pointer to string of char type symbols is expected. bootsup.c 600
  • And 4 additional diagnostic messages.

<< Return to list of all diagnostics