Skip to content

Commit eed910d

Browse files
authored
Fix some minor issues in samples found by CodeQL (microsoft#345)
1 parent d396f85 commit eed910d

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ and allows the community to support Detours using open source tools and processe
77

88
Detours is compatible with the Windows NT family of
99
operating systems: Windows NT, Windows XP, Windows Server 2003, Windows 7,
10-
Windows 8, and Windows 10. It cannot be used by Windows Store apps
10+
Windows 8, Windows 10, and Windows 11. It cannot be used by Windows Store apps
1111
because Detours requires APIs not available to those applications.
1212
This repo contains the source code for version 4.0.1 of Detours.
1313

samples/syelog/syelog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static PCHAR do_estr(PCHAR pszOut, PCHAR pszEnd, PCSTR pszIn)
159159
*pszOut++ = '0' + (c % 10);
160160
*pszOut++ = ';';
161161
}
162-
else if (c < 1000 && pszOut + 6 <= pszEnd) {
162+
else if (pszOut + 6 <= pszEnd) {
163163
*pszOut++ = '&';
164164
*pszOut++ = '#';
165165
*pszOut++ = '0' + ((c / 100) % 10);

samples/traceapi/trcapi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ BOOL ProcessEnumerate()
352352
Syelog(SYELOG_SEVERITY_INFORMATION, "###\n");
353353

354354
LPVOID lpvEnv = Real_GetEnvironmentStrings();
355-
Syelog(SYELOG_SEVERITY_INFORMATION, "### Env= %08x [%08x %08x]\n",
355+
Syelog(SYELOG_SEVERITY_INFORMATION, "### Env= %p [%p %p]\n",
356356
lpvEnv, ((PVOID*)lpvEnv)[0], ((PVOID*)lpvEnv)[1]);
357357

358358
return TRUE;

samples/tracebld/trcbld.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1752,7 +1752,7 @@ static PCHAR do_estr(PCHAR pszOut, PCHAR pszEnd, PCSTR pszIn)
17521752
*pszOut++ = '0' + (c % 10);
17531753
*pszOut++ = ';';
17541754
}
1755-
else if (c < 1000 && pszOut + 6 <= pszEnd) {
1755+
else if (pszOut + 6 <= pszEnd) {
17561756
*pszOut++ = '&';
17571757
*pszOut++ = '#';
17581758
*pszOut++ = '0' + ((c / 100) % 10);

samples/tryman/tstman.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,16 @@ void DumpModuleInfo(HMODULE hModule)
164164
}
165165

166166
if (pinh->FileHeader.Machine == 0x8664) {
167-
StringCchPrintfA(szMachine, ARRAYSIZE(szMachine), "x64", pinh->FileHeader.Machine);
167+
StringCchPrintfA(szMachine, ARRAYSIZE(szMachine), "x64");
168168
}
169169
else if (pinh->FileHeader.Machine == 0x014c) {
170-
StringCchPrintfA(szMachine, ARRAYSIZE(szMachine), "x86", pinh->FileHeader.Machine);
170+
StringCchPrintfA(szMachine, ARRAYSIZE(szMachine), "x86");
171171
}
172172
else if (pinh->FileHeader.Machine == 0x0200) {
173-
StringCchPrintfA(szMachine, ARRAYSIZE(szMachine), "i64", pinh->FileHeader.Machine);
173+
StringCchPrintfA(szMachine, ARRAYSIZE(szMachine), "i64");
174174
}
175175
else if (pinh->FileHeader.Machine == 0x01c0) {
176-
StringCchPrintfA(szMachine, ARRAYSIZE(szMachine), "arm", pinh->FileHeader.Machine);
176+
StringCchPrintfA(szMachine, ARRAYSIZE(szMachine), "arm");
177177
}
178178
else {
179179
StringCchPrintfA(szMachine, ARRAYSIZE(szMachine), "%04x", pinh->FileHeader.Machine);

0 commit comments

Comments
 (0)