Примеры ошибок, обнаруженных с помощью диагностики V541
V541. String is printed into itself. Consider inspecting the expression.
PCSX2
V541 It is dangerous to print the string 'fileData' into itself. pcsx2 patchbrowser.cpp 211
void ListPatches (HWND hW) {
....
while((tmpi=fgetc(fp)) != EOF)
sprintf(fileData,"%s%c",fileData,tmpi);
....
sprintf(tmpStr,"%s (%s)",tmpStr,FindData.cFileName);
....
}
The code might work, but this is a dangerous game.
Similar errors can be found in some other places:
- V541 It is dangerous to print the string 'tmpStr' into itself. pcsx2 patchbrowser.cpp 239
CAMEL
V541 It is dangerous to print the string 'szOperatingSystem' into itself. stickies camel.cpp 572
char * OSDetection ()
{
....
sprintf (szOperatingSystem, "%sversion %d.%d %s (Build %d)",
szOperatingSystem,
osvi.dwMajorVersion,
osvi.dwMinorVersion,
osvi.szCSDVersion,
osvi.dwBuildNumber & 0xFFFF);
....
sprintf (szOperatingSystem, "%s%s(Build %d)",
szOperatingSystem, osvi.szCSDVersion,
osvi.dwBuildNumber & 0xFFFF);
....
}
The code might work, but this is a dangerous game.
Similar errors can be found in some other places:
- V541 It is dangerous to print the string 'szOperatingSystem' into itself. stickies camel.cpp 603
Mozilla Firefox
V541 It is dangerous to print the string 'newhost' into itself. ssltunnel.cpp 531
bool AdjustWebSocketHost(relayBuffer& buffer,
connection_info_t *ci)
{
....
sprintf(newhost, "%s:%d", newhost,
PR_ntohs(inet_addr.inet.port));
....
}
The code might work, but this is a dangerous game.
UCSniff
V541 It is dangerous to print the string 'dst' into itself. vc_format.c 177
int hex_format(...., u_char *dst)
{
....
sprintf(dst, "%s %04x: ", dst, i );
....
}
The code might work, but this is a dangerous game.
Similar errors can be found in some other places:
- V541 It is dangerous to print the string 'dst' into itself. vc_format.c 183
- V541 It is dangerous to print the string 'dst' into itself. vc_format.c 185
- V541 It is dangerous to print the string 'dst' into itself. vc_format.c 200
TinyCAD
V541 It is dangerous to print the string 'csText' into itself. childfrm.cpp 79
void CChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
{
....
CString csText;
....
if (m_nWindow > 0)
csText.Format(_T("%s: %d"), csText, m_nWindow);
....
}
Scilab
V541 It is dangerous to print the string 'lines' into itself. sci_toprint.cpp 314
static int sci_toprint_two_rhs(void* _pvCtx,
const char *fname)
{
....
sprintf(lines, "%s%s\n", lines, pStVarOne[i]);
....
}
Similar errors can be found in some other places:
- V541 It is dangerous to print the string 'coserr.buf' into itself. sci_coserror.c 94
FreeBSD Kernel
V541 It is dangerous to print the string 'buffer' into itself. ata-highpoint.c 102
static int
ata_highpoint_probe(device_t dev)
{
....
char buffer[64];
....
strcpy(buffer, "HighPoint ");
strcat(buffer, idx->text);
if (idx->cfg1 == HPT_374) {
if (pci_get_function(dev) == 0)
strcat(buffer, " (channel 0+1)");
if (pci_get_function(dev) == 1)
strcat(buffer, " (channel 2+3)");
}
sprintf(buffer, "%s %s controller",
buffer, ata_mode2str(idx->max_dma));
....
}
Similar errors can be found in some other places:
- V541 It is dangerous to print the string 'buffer' into itself. ata-promise.c 208
Serious Engine 1 v.1.10
V541 It is dangerous to print the string 'achrDefaultScript' into itself. dlgcreateanimatedtexture.cpp 359
BOOL CDlgCreateAnimatedTexture::OnInitDialog()
{
....
// allocate 16k for script
char achrDefaultScript[ 16384];
// default script into edit control
sprintf( achrDefaultScript, ....); // <=
....
// add finishing part of script
sprintf( achrDefaultScript, // <=
"%sANIM_END\r\nEND\r\n", // <=
achrDefaultScript); // <=
....
}
Ardour
V541 It is dangerous to print the 'buf' string into itself. luawindow.cc 490
void
LuaWindow::save_script ()
{
....
do {
char buf[80];
time_t t = time(0);
struct tm * timeinfo = localtime (&t);
strftime (buf, sizeof(buf), "%s%d", timeinfo);
sprintf (buf, "%s%ld", buf, random ());
....
}