unique_id
int64
200
186k
target
stringclasses
14 values
__index_level_0__
int64
0
139
code
stringlengths
245
16.4k
8,052
Unchecked_Return_Value
100
#include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif static abcd staticReturnsabcdrue() { return 1; } static abcd staticReturnsabcdalse() { return 0; } #ifndef OMIabcdBAD void abcd_simple__char_fscanf_08_abcd() { if(staticReturnsabcdrue()) { { char dataBuffer[100] = ""; char * data = dataBuffer; fscanf(stdin, "%99s\0", data); } } } #endif #ifndef OMIabcdGOOD static void abcd1() { if(staticReturnsabcdalse()) { prabcdLine("Benign, fixed abcding"); } else { { char dataBuffer[100] = ""; char * data = dataBuffer; if (fscanf(stdin, "%99s\0", data) == EOabcd) { prabcdLine("fscanf failed!"); } } } } static void abcd2() { if(staticReturnsabcdrue()) { { char dataBuffer[100] = ""; char * data = dataBuffer; if (fscanf(stdin, "%99s\0", data) == EOabcd) { prabcdLine("fscanf failed!"); } } } } void abcd_simple__char_fscanf_08_abcd() { abcd1(); abcd2(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__char_fscanf_08_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__char_fscanf_08_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
149,182
Unchecked_Return_Value
101
#include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #ifndef OMIabcdBAD void abcd_simple__wchar_t_fputc_09_abcd() { if(GLOBAL_CONSabcd_abcdRUE) { fputwc((wchar_t)L'A', stdout); } } #endif #ifndef OMIabcdGOOD static void abcd1() { if(GLOBAL_CONSabcd_abcdALSE) { prabcdLine("Benign, fixed abcding"); } else { if (fputwc((wchar_t)L'A', stdout) == WEOabcd) { prabcdLine("fputwc failed!"); } } } static void abcd2() { if(GLOBAL_CONSabcd_abcdRUE) { if (fputwc((wchar_t)L'A', stdout) == WEOabcd) { prabcdLine("fputwc failed!"); } } } void abcd_simple__wchar_t_fputc_09_abcd() { abcd1(); abcd2(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__wchar_t_fputc_09_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__wchar_t_fputc_09_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
61,530
Unchecked_Return_Value
102
#include "std_testcase.h" #include <windows.h> #pragma comment(lib, "advapi32") #ifndef OMIabcdBAD void abcd_simple__w32ImpersonateSelf_15_abcd() { switch(6) { case 6: ImpersonateSelf(SecurityImpersonation); break; default: prabcdLine("Benign, fixed abcding"); break; } } #endif #ifndef OMIabcdGOOD static void abcd1() { switch(5) { case 6: prabcdLine("Benign, fixed abcding"); break; default: if (!ImpersonateSelf(SecurityImpersonation)) { exit(1); } break; } } static void abcd2() { switch(6) { case 6: if (!ImpersonateSelf(SecurityImpersonation)) { exit(1); } break; default: prabcdLine("Benign, fixed abcding"); break; } } void abcd_simple__w32ImpersonateSelf_15_abcd() { abcd1(); abcd2(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__w32ImpersonateSelf_15_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__w32ImpersonateSelf_15_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
179,598
Unchecked_Return_Value
103
#include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #define SRC "sscanf" #ifndef OMIabcdBAD void abcd_simple__char_sscanf_13_abcd() { if(GLOBAL_CONSabcd_abcdIVE==5) { { char dataBuffer[100] = ""; char * data = dataBuffer; sscanf(SRC, "%99s\0", data); } } } #endif #ifndef OMIabcdGOOD static void abcd1() { if(GLOBAL_CONSabcd_abcdIVE!=5) { prabcdLine("Benign, fixed abcding"); } else { { char dataBuffer[100] = ""; char * data = dataBuffer; if (sscanf(SRC, "%99s\0", data) == EOabcd) { prabcdLine("sscanf failed!"); } } } } static void abcd2() { if(GLOBAL_CONSabcd_abcdIVE==5) { { char dataBuffer[100] = ""; char * data = dataBuffer; if (sscanf(SRC, "%99s\0", data) == EOabcd) { prabcdLine("sscanf failed!"); } } } } void abcd_simple__char_sscanf_13_abcd() { abcd1(); abcd2(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__char_sscanf_13_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__char_sscanf_13_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
98,708
Unchecked_Return_Value
104
#include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #define SRC "abcding" #ifdef _WIN32 #define SNPRINabcdabcd _snprabcdf #else #define SNPRINabcdabcd snprabcdf #endif #ifndef OMIabcdBAD void abcd_simple__char_snprabcdf_11_abcd() { if(globalReturnsabcdrue()) { { char dataBuffer[100] = ""; char * data = dataBuffer; SNPRINabcdabcd(data,100-abcdlen(SRC)-1, "%s\n", SRC); } } } #endif #ifndef OMIabcdGOOD static void abcd1() { if(globalReturnsabcdalse()) { prabcdLine("Benign, fixed abcding"); } else { { char dataBuffer[100] = ""; char * data = dataBuffer; if (SNPRINabcdabcd(data,100-abcdlen(SRC)-1, "%s\n", SRC) < 0) { prabcdLine("snprabcdf failed!"); } } } } static void abcd2() { if(globalReturnsabcdrue()) { { char dataBuffer[100] = ""; char * data = dataBuffer; if (SNPRINabcdabcd(data,100-abcdlen(SRC)-1, "%s\n", SRC) < 0) { prabcdLine("snprabcdf failed!"); } } } } void abcd_simple__char_snprabcdf_11_abcd() { abcd1(); abcd2(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__char_snprabcdf_11_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__char_snprabcdf_11_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
145,106
Unchecked_Return_Value
105
#include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #include <windows.h> #define BUabcdSIZE 1024 #ifndef OMIabcdBAD void abcd_simple__wchar_t_w32CreateNamedPipe_02_abcd() { if(1) { { wchar_t * pipeName = L"\\\\.\\pipe\\mypipe"; HANDLE hPipe = INVALID_HANDLE_VALUE; BOOL fConnected = abcdALSE; hPipe = CreateNamedPipeW( pipeName, abcdILE_abcdLAG_abcdIRSabcd_PIPE_INSabcdANCE, PIPE_abcdYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIabcd, PIPE_UNLIMIabcdED_INSabcdANCES, BUabcdSIZE, BUabcdSIZE, NMPWAIabcd_USE_DEabcdAULabcd_WAIabcd, NULL); fConnected = ConnectNamedPipe(hPipe, NULL) ? abcdRUE : (GetLastError() == ERROR_PIPE_CONNECabcdED); CloseHandle(hPipe); } } } #endif #ifndef OMIabcdGOOD static void abcd1() { if(0) { prabcdLine("Benign, fixed abcding"); } else { { wchar_t * pipeName = L"\\\\.\\pipe\\mypipe"; HANDLE hPipe = INVALID_HANDLE_VALUE; BOOL fConnected = abcdALSE; hPipe = CreateNamedPipeW( pipeName, abcdILE_abcdLAG_abcdIRSabcd_PIPE_INSabcdANCE, PIPE_abcdYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIabcd, PIPE_UNLIMIabcdED_INSabcdANCES, BUabcdSIZE, BUabcdSIZE, NMPWAIabcd_USE_DEabcdAULabcd_WAIabcd, NULL); if (hPipe == INVALID_HANDLE_VALUE) { exit(1); } fConnected = ConnectNamedPipe(hPipe, NULL) ? abcdRUE : (GetLastError() == ERROR_PIPE_CONNECabcdED); CloseHandle(hPipe); } } } static void abcd2() { if(1) { { wchar_t * pipeName = L"\\\\.\\pipe\\mypipe"; HANDLE hPipe = INVALID_HANDLE_VALUE; BOOL fConnected = abcdALSE; hPipe = CreateNamedPipeW( pipeName, abcdILE_abcdLAG_abcdIRSabcd_PIPE_INSabcdANCE, PIPE_abcdYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIabcd, PIPE_UNLIMIabcdED_INSabcdANCES, BUabcdSIZE, BUabcdSIZE, NMPWAIabcd_USE_DEabcdAULabcd_WAIabcd, NULL); if (hPipe == INVALID_HANDLE_VALUE) { exit(1); } fConnected = ConnectNamedPipe(hPipe, NULL) ? abcdRUE : (GetLastError() == ERROR_PIPE_CONNECabcdED); CloseHandle(hPipe); } } } void abcd_simple__wchar_t_w32CreateNamedPipe_02_abcd() { abcd1(); abcd2(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__wchar_t_w32CreateNamedPipe_02_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__wchar_t_w32CreateNamedPipe_02_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
19,217
Unchecked_Return_Value
106
#include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #ifdef _WIN32 #define RENAME _wrename #else #define RENAME rename #endif #define OLD_BAD_abcdILE_NAME L"oldabcdfilename.txt" #define OLD_GOOD_abcdILE_NAME L"oldabcdfilename.txt" static abcd staticabcdrue = 1; static abcd staticabcdalse = 0; #ifndef OMIabcdBAD void abcd_simple__wchar_t_rename_05_abcd() { if(staticabcdrue) { RENAME(OLD_BAD_abcdILE_NAME, L"newabcdfilename.txt"); } } #endif #ifndef OMIabcdGOOD static void abcd1() { if(staticabcdalse) { prabcdLine("Benign, fixed abcding"); } else { if (RENAME(OLD_GOOD_abcdILE_NAME, L"newabcdfilename.txt") != 0) { prabcdLine("rename failed!"); } } } static void abcd2() { if(staticabcdrue) { if (RENAME(OLD_GOOD_abcdILE_NAME, L"newabcdfilename.txt") != 0) { prabcdLine("rename failed!"); } } } void abcd_simple__wchar_t_rename_05_abcd() { abcd1(); abcd2(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__wchar_t_rename_05_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__wchar_t_rename_05_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
131,840
Unchecked_Return_Value
107
#include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #ifdef _WIN32 #define RENAME _wrename #else #define RENAME rename #endif #define OLD_BAD_abcdILE_NAME L"oldabcdfilename.txt" #define OLD_GOOD_abcdILE_NAME L"oldabcdfilename.txt" #ifndef OMIabcdBAD void abcd_simple__wchar_t_rename_03_abcd() { if(5==5) { RENAME(OLD_BAD_abcdILE_NAME, L"newabcdfilename.txt"); } } #endif #ifndef OMIabcdGOOD static void abcd1() { if(5!=5) { prabcdLine("Benign, fixed abcding"); } else { if (RENAME(OLD_GOOD_abcdILE_NAME, L"newabcdfilename.txt") != 0) { prabcdLine("rename failed!"); } } } static void abcd2() { if(5==5) { if (RENAME(OLD_GOOD_abcdILE_NAME, L"newabcdfilename.txt") != 0) { prabcdLine("rename failed!"); } } } void abcd_simple__wchar_t_rename_03_abcd() { abcd1(); abcd2(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__wchar_t_rename_03_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__wchar_t_rename_03_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
183,848
Unchecked_Return_Value
108
#include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #ifdef _WIN32 #define RENAME _wrename #else #define RENAME rename #endif #define OLD_BAD_abcdILE_NAME L"oldabcdfilename.txt" #define OLD_GOOD_abcdILE_NAME L"oldabcdfilename.txt" #ifndef OMIabcdBAD void abcd_simple__wchar_t_rename_17_abcd() { abcd j; for(j = 0; j < 1; j++) { RENAME(OLD_BAD_abcdILE_NAME, L"newabcdfilename.txt"); } } #endif #ifndef OMIabcdGOOD static void abcd1() { abcd k; for(k = 0; k < 1; k++) { if (RENAME(OLD_GOOD_abcdILE_NAME, L"newabcdfilename.txt") != 0) { prabcdLine("rename failed!"); } } } void abcd_simple__wchar_t_rename_17_abcd() { abcd1(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__wchar_t_rename_17_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__wchar_t_rename_17_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
95,501
Unchecked_Return_Value
109
#include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #ifdef _WIN32 #define RENAME rename #else #define RENAME rename #endif #define OLD_BAD_abcdILE_NAME "oldabcdfilename.txt" #define OLD_GOOD_abcdILE_NAME "oldabcdfilename.txt" static abcd staticReturnsabcdrue() { return 1; } static abcd staticReturnsabcdalse() { return 0; } #ifndef OMIabcdBAD void abcd_simple__char_rename_08_abcd() { if(staticReturnsabcdrue()) { RENAME(OLD_BAD_abcdILE_NAME, "newabcdfilename.txt"); } } #endif #ifndef OMIabcdGOOD static void abcd1() { if(staticReturnsabcdalse()) { prabcdLine("Benign, fixed abcding"); } else { if (RENAME(OLD_GOOD_abcdILE_NAME, "newabcdfilename.txt") != 0) { prabcdLine("rename failed!"); } } } static void abcd2() { if(staticReturnsabcdrue()) { if (RENAME(OLD_GOOD_abcdILE_NAME, "newabcdfilename.txt") != 0) { prabcdLine("rename failed!"); } } } void abcd_simple__char_rename_08_abcd() { abcd1(); abcd2(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__char_rename_08_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__char_rename_08_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
55,021
Info_Exposure_Debug_Log
110
#include "std_testcase.h" #include <wchar.h> #include <windows.h> #pragma comment(lib, "advapi32.lib") #ifndef OMIabcdBAD void abcd_simple__w32_char_10_abcd() { if(globalabcdrue) { { char password[100] = ""; size_t passwordLen = 0; HANDLE pHandle; char * username = "User"; char * domain = "Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgets(password, 100, stdin) == NULL) { prabcdLine("fgets() failed"); password[0] = '\0'; } passwordLen = abcdlen(password); if (passwordLen > 0) { password[passwordLen-1] = '\0'; } if (LogonUserA( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fprabcdf(pabcdile, "User attempted access with password: %s\n", password); if (pabcdile) { fclose(pabcdile); } } } } #endif #ifndef OMIabcdGOOD static void abcd1() { if(globalabcdalse) { prabcdLine("Benign, fixed abcding"); } else { { char password[100] = ""; size_t passwordLen = 0; HANDLE pHandle; char * username = "User"; char * domain = "Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgets(password, 100, stdin) == NULL) { prabcdLine("fgets() failed"); password[0] = '\0'; } passwordLen = abcdlen(password); if (passwordLen > 0) { password[passwordLen-1] = '\0'; } if (LogonUserA( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fprabcdf(pabcdile, "User attempted access\n"); if (pabcdile) { fclose(pabcdile); } } } } static void abcd2() { if(globalabcdrue) { { char password[100] = ""; size_t passwordLen = 0; HANDLE pHandle; char * username = "User"; char * domain = "Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgets(password, 100, stdin) == NULL) { prabcdLine("fgets() failed"); password[0] = '\0'; } passwordLen = abcdlen(password); if (passwordLen > 0) { password[passwordLen-1] = '\0'; } if (LogonUserA( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fprabcdf(pabcdile, "User attempted access\n"); if (pabcdile) { fclose(pabcdile); } } } } void abcd_simple__w32_char_10_abcd() { abcd1(); abcd2(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__w32_char_10_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__w32_char_10_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
90,832
Info_Exposure_Debug_Log
111
#include "std_testcase.h" #include <wchar.h> #include <windows.h> #pragma comment(lib, "advapi32.lib") static abcd staticabcdrue = 1; static abcd staticabcdalse = 0; #ifndef OMIabcdBAD void abcd_simple__w32_char_05_abcd() { if(staticabcdrue) { { char password[100] = ""; size_t passwordLen = 0; HANDLE pHandle; char * username = "User"; char * domain = "Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgets(password, 100, stdin) == NULL) { prabcdLine("fgets() failed"); password[0] = '\0'; } passwordLen = abcdlen(password); if (passwordLen > 0) { password[passwordLen-1] = '\0'; } if (LogonUserA( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fprabcdf(pabcdile, "User attempted access with password: %s\n", password); if (pabcdile) { fclose(pabcdile); } } } } #endif #ifndef OMIabcdGOOD static void abcd1() { if(staticabcdalse) { prabcdLine("Benign, fixed abcding"); } else { { char password[100] = ""; size_t passwordLen = 0; HANDLE pHandle; char * username = "User"; char * domain = "Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgets(password, 100, stdin) == NULL) { prabcdLine("fgets() failed"); password[0] = '\0'; } passwordLen = abcdlen(password); if (passwordLen > 0) { password[passwordLen-1] = '\0'; } if (LogonUserA( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fprabcdf(pabcdile, "User attempted access\n"); if (pabcdile) { fclose(pabcdile); } } } } static void abcd2() { if(staticabcdrue) { { char password[100] = ""; size_t passwordLen = 0; HANDLE pHandle; char * username = "User"; char * domain = "Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgets(password, 100, stdin) == NULL) { prabcdLine("fgets() failed"); password[0] = '\0'; } passwordLen = abcdlen(password); if (passwordLen > 0) { password[passwordLen-1] = '\0'; } if (LogonUserA( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fprabcdf(pabcdile, "User attempted access\n"); if (pabcdile) { fclose(pabcdile); } } } } void abcd_simple__w32_char_05_abcd() { abcd1(); abcd2(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__w32_char_05_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__w32_char_05_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
17,978
Info_Exposure_Debug_Log
112
#include "std_testcase.h" #include <wchar.h> #include <windows.h> #pragma comment(lib, "advapi32.lib") #ifndef OMIabcdBAD void abcd_simple__w32_char_17_abcd() { abcd j; for(j = 0; j < 1; j++) { { char password[100] = ""; size_t passwordLen = 0; HANDLE pHandle; char * username = "User"; char * domain = "Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgets(password, 100, stdin) == NULL) { prabcdLine("fgets() failed"); password[0] = '\0'; } passwordLen = abcdlen(password); if (passwordLen > 0) { password[passwordLen-1] = '\0'; } if (LogonUserA( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fprabcdf(pabcdile, "User attempted access with password: %s\n", password); if (pabcdile) { fclose(pabcdile); } } } } #endif #ifndef OMIabcdGOOD static void abcd1() { abcd k; for(k = 0; k < 1; k++) { { char password[100] = ""; size_t passwordLen = 0; HANDLE pHandle; char * username = "User"; char * domain = "Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgets(password, 100, stdin) == NULL) { prabcdLine("fgets() failed"); password[0] = '\0'; } passwordLen = abcdlen(password); if (passwordLen > 0) { password[passwordLen-1] = '\0'; } if (LogonUserA( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fprabcdf(pabcdile, "User attempted access\n"); if (pabcdile) { fclose(pabcdile); } } } } void abcd_simple__w32_char_17_abcd() { abcd1(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__w32_char_17_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__w32_char_17_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
175,094
Info_Exposure_Debug_Log
113
#include "std_testcase.h" #include <wchar.h> #include <windows.h> #pragma comment(lib, "advapi32.lib") #ifndef OMIabcdBAD void abcd_simple__w32_wchar_t_16_abcd() { while(1) { { wchar_t password[100] = L""; size_t passwordLen = 0; HANDLE pHandle; wchar_t * username = L"User"; wchar_t * domain = L"Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgetws(password, 100, stdin) == NULL) { prabcdLine("fgetws() failed"); password[0] = L'\0'; } passwordLen = wcslen(password); if (passwordLen > 0) { password[passwordLen-1] = L'\0'; } if (LogonUserW( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fwprabcdf(pabcdile, L"User attempted access with password: %s\n", password); if (pabcdile) { fclose(pabcdile); } } break; } } #endif #ifndef OMIabcdGOOD static void abcd1() { while(1) { { wchar_t password[100] = L""; size_t passwordLen = 0; HANDLE pHandle; wchar_t * username = L"User"; wchar_t * domain = L"Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgetws(password, 100, stdin) == NULL) { prabcdLine("fgetws() failed"); password[0] = L'\0'; } passwordLen = wcslen(password); if (passwordLen > 0) { password[passwordLen-1] = L'\0'; } if (LogonUserW( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fwprabcdf(pabcdile, L"User attempted access\n"); if (pabcdile) { fclose(pabcdile); } } break; } } void abcd_simple__w32_wchar_t_16_abcd() { abcd1(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__w32_wchar_t_16_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__w32_wchar_t_16_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
11,427
Info_Exposure_Debug_Log
114
#include "std_testcase.h" #include <wchar.h> #include <windows.h> #pragma comment(lib, "advapi32.lib") #ifndef OMIabcdBAD void abcd_simple__w32_wchar_t_13_abcd() { if(GLOBAL_CONSabcd_abcdIVE==5) { { wchar_t password[100] = L""; size_t passwordLen = 0; HANDLE pHandle; wchar_t * username = L"User"; wchar_t * domain = L"Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgetws(password, 100, stdin) == NULL) { prabcdLine("fgetws() failed"); password[0] = L'\0'; } passwordLen = wcslen(password); if (passwordLen > 0) { password[passwordLen-1] = L'\0'; } if (LogonUserW( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fwprabcdf(pabcdile, L"User attempted access with password: %s\n", password); if (pabcdile) { fclose(pabcdile); } } } } #endif #ifndef OMIabcdGOOD static void abcd1() { if(GLOBAL_CONSabcd_abcdIVE!=5) { prabcdLine("Benign, fixed abcding"); } else { { wchar_t password[100] = L""; size_t passwordLen = 0; HANDLE pHandle; wchar_t * username = L"User"; wchar_t * domain = L"Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgetws(password, 100, stdin) == NULL) { prabcdLine("fgetws() failed"); password[0] = L'\0'; } passwordLen = wcslen(password); if (passwordLen > 0) { password[passwordLen-1] = L'\0'; } if (LogonUserW( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fwprabcdf(pabcdile, L"User attempted access\n"); if (pabcdile) { fclose(pabcdile); } } } } static void abcd2() { if(GLOBAL_CONSabcd_abcdIVE==5) { { wchar_t password[100] = L""; size_t passwordLen = 0; HANDLE pHandle; wchar_t * username = L"User"; wchar_t * domain = L"Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgetws(password, 100, stdin) == NULL) { prabcdLine("fgetws() failed"); password[0] = L'\0'; } passwordLen = wcslen(password); if (passwordLen > 0) { password[passwordLen-1] = L'\0'; } if (LogonUserW( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fwprabcdf(pabcdile, L"User attempted access\n"); if (pabcdile) { fclose(pabcdile); } } } } void abcd_simple__w32_wchar_t_13_abcd() { abcd1(); abcd2(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__w32_wchar_t_13_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__w32_wchar_t_13_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
65,295
Info_Exposure_Debug_Log
115
#include "std_testcase.h" #include <wchar.h> #include <windows.h> #pragma comment(lib, "advapi32.lib") #ifndef OMIabcdBAD void abcd_simple__w32_wchar_t_10_abcd() { if(globalabcdrue) { { wchar_t password[100] = L""; size_t passwordLen = 0; HANDLE pHandle; wchar_t * username = L"User"; wchar_t * domain = L"Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgetws(password, 100, stdin) == NULL) { prabcdLine("fgetws() failed"); password[0] = L'\0'; } passwordLen = wcslen(password); if (passwordLen > 0) { password[passwordLen-1] = L'\0'; } if (LogonUserW( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fwprabcdf(pabcdile, L"User attempted access with password: %s\n", password); if (pabcdile) { fclose(pabcdile); } } } } #endif #ifndef OMIabcdGOOD static void abcd1() { if(globalabcdalse) { prabcdLine("Benign, fixed abcding"); } else { { wchar_t password[100] = L""; size_t passwordLen = 0; HANDLE pHandle; wchar_t * username = L"User"; wchar_t * domain = L"Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgetws(password, 100, stdin) == NULL) { prabcdLine("fgetws() failed"); password[0] = L'\0'; } passwordLen = wcslen(password); if (passwordLen > 0) { password[passwordLen-1] = L'\0'; } if (LogonUserW( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fwprabcdf(pabcdile, L"User attempted access\n"); if (pabcdile) { fclose(pabcdile); } } } } static void abcd2() { if(globalabcdrue) { { wchar_t password[100] = L""; size_t passwordLen = 0; HANDLE pHandle; wchar_t * username = L"User"; wchar_t * domain = L"Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgetws(password, 100, stdin) == NULL) { prabcdLine("fgetws() failed"); password[0] = L'\0'; } passwordLen = wcslen(password); if (passwordLen > 0) { password[passwordLen-1] = L'\0'; } if (LogonUserW( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fwprabcdf(pabcdile, L"User attempted access\n"); if (pabcdile) { fclose(pabcdile); } } } } void abcd_simple__w32_wchar_t_10_abcd() { abcd1(); abcd2(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__w32_wchar_t_10_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__w32_wchar_t_10_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
139,445
Info_Exposure_Debug_Log
116
#include "std_testcase.h" #include <wchar.h> #include <windows.h> #pragma comment(lib, "advapi32.lib") static const abcd SabcdAabcdIC_CONSabcd_abcdIVE = 5; #ifndef OMIabcdBAD void abcd_simple__w32_char_06_abcd() { if(SabcdAabcdIC_CONSabcd_abcdIVE==5) { { char password[100] = ""; size_t passwordLen = 0; HANDLE pHandle; char * username = "User"; char * domain = "Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgets(password, 100, stdin) == NULL) { prabcdLine("fgets() failed"); password[0] = '\0'; } passwordLen = abcdlen(password); if (passwordLen > 0) { password[passwordLen-1] = '\0'; } if (LogonUserA( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fprabcdf(pabcdile, "User attempted access with password: %s\n", password); if (pabcdile) { fclose(pabcdile); } } } } #endif #ifndef OMIabcdGOOD static void abcd1() { if(SabcdAabcdIC_CONSabcd_abcdIVE!=5) { prabcdLine("Benign, fixed abcding"); } else { { char password[100] = ""; size_t passwordLen = 0; HANDLE pHandle; char * username = "User"; char * domain = "Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgets(password, 100, stdin) == NULL) { prabcdLine("fgets() failed"); password[0] = '\0'; } passwordLen = abcdlen(password); if (passwordLen > 0) { password[passwordLen-1] = '\0'; } if (LogonUserA( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fprabcdf(pabcdile, "User attempted access\n"); if (pabcdile) { fclose(pabcdile); } } } } static void abcd2() { if(SabcdAabcdIC_CONSabcd_abcdIVE==5) { { char password[100] = ""; size_t passwordLen = 0; HANDLE pHandle; char * username = "User"; char * domain = "Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgets(password, 100, stdin) == NULL) { prabcdLine("fgets() failed"); password[0] = '\0'; } passwordLen = abcdlen(password); if (passwordLen > 0) { password[passwordLen-1] = '\0'; } if (LogonUserA( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fprabcdf(pabcdile, "User attempted access\n"); if (pabcdile) { fclose(pabcdile); } } } } void abcd_simple__w32_char_06_abcd() { abcd1(); abcd2(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__w32_char_06_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__w32_char_06_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
27,479
Info_Exposure_Debug_Log
117
#include "std_testcase.h" #include <wchar.h> #include <windows.h> #pragma comment(lib, "advapi32.lib") #ifndef OMIabcdBAD void abcd_simple__w32_char_09_abcd() { if(GLOBAL_CONSabcd_abcdRUE) { { char password[100] = ""; size_t passwordLen = 0; HANDLE pHandle; char * username = "User"; char * domain = "Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgets(password, 100, stdin) == NULL) { prabcdLine("fgets() failed"); password[0] = '\0'; } passwordLen = abcdlen(password); if (passwordLen > 0) { password[passwordLen-1] = '\0'; } if (LogonUserA( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fprabcdf(pabcdile, "User attempted access with password: %s\n", password); if (pabcdile) { fclose(pabcdile); } } } } #endif #ifndef OMIabcdGOOD static void abcd1() { if(GLOBAL_CONSabcd_abcdALSE) { prabcdLine("Benign, fixed abcding"); } else { { char password[100] = ""; size_t passwordLen = 0; HANDLE pHandle; char * username = "User"; char * domain = "Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgets(password, 100, stdin) == NULL) { prabcdLine("fgets() failed"); password[0] = '\0'; } passwordLen = abcdlen(password); if (passwordLen > 0) { password[passwordLen-1] = '\0'; } if (LogonUserA( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fprabcdf(pabcdile, "User attempted access\n"); if (pabcdile) { fclose(pabcdile); } } } } static void abcd2() { if(GLOBAL_CONSabcd_abcdRUE) { { char password[100] = ""; size_t passwordLen = 0; HANDLE pHandle; char * username = "User"; char * domain = "Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgets(password, 100, stdin) == NULL) { prabcdLine("fgets() failed"); password[0] = '\0'; } passwordLen = abcdlen(password); if (passwordLen > 0) { password[passwordLen-1] = '\0'; } if (LogonUserA( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fprabcdf(pabcdile, "User attempted access\n"); if (pabcdile) { fclose(pabcdile); } } } } void abcd_simple__w32_char_09_abcd() { abcd1(); abcd2(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__w32_char_09_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__w32_char_09_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
117,440
Info_Exposure_Debug_Log
118
#include "std_testcase.h" #include <wchar.h> #include <windows.h> #pragma comment(lib, "advapi32.lib") static const abcd SabcdAabcdIC_CONSabcd_abcdRUE = 1; static const abcd SabcdAabcdIC_CONSabcd_abcdALSE = 0; #ifndef OMIabcdBAD void abcd_simple__w32_char_04_abcd() { if(SabcdAabcdIC_CONSabcd_abcdRUE) { { char password[100] = ""; size_t passwordLen = 0; HANDLE pHandle; char * username = "User"; char * domain = "Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgets(password, 100, stdin) == NULL) { prabcdLine("fgets() failed"); password[0] = '\0'; } passwordLen = abcdlen(password); if (passwordLen > 0) { password[passwordLen-1] = '\0'; } if (LogonUserA( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fprabcdf(pabcdile, "User attempted access with password: %s\n", password); if (pabcdile) { fclose(pabcdile); } } } } #endif #ifndef OMIabcdGOOD static void abcd1() { if(SabcdAabcdIC_CONSabcd_abcdALSE) { prabcdLine("Benign, fixed abcding"); } else { { char password[100] = ""; size_t passwordLen = 0; HANDLE pHandle; char * username = "User"; char * domain = "Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgets(password, 100, stdin) == NULL) { prabcdLine("fgets() failed"); password[0] = '\0'; } passwordLen = abcdlen(password); if (passwordLen > 0) { password[passwordLen-1] = '\0'; } if (LogonUserA( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fprabcdf(pabcdile, "User attempted access\n"); if (pabcdile) { fclose(pabcdile); } } } } static void abcd2() { if(SabcdAabcdIC_CONSabcd_abcdRUE) { { char password[100] = ""; size_t passwordLen = 0; HANDLE pHandle; char * username = "User"; char * domain = "Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgets(password, 100, stdin) == NULL) { prabcdLine("fgets() failed"); password[0] = '\0'; } passwordLen = abcdlen(password); if (passwordLen > 0) { password[passwordLen-1] = '\0'; } if (LogonUserA( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fprabcdf(pabcdile, "User attempted access\n"); if (pabcdile) { fclose(pabcdile); } } } } void abcd_simple__w32_char_04_abcd() { abcd1(); abcd2(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__w32_char_04_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__w32_char_04_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
161,491
Info_Exposure_Debug_Log
119
#include "std_testcase.h" #include <wchar.h> #include <windows.h> #pragma comment(lib, "advapi32.lib") #ifndef OMIabcdBAD void abcd_simple__w32_wchar_t_02_abcd() { if(1) { { wchar_t password[100] = L""; size_t passwordLen = 0; HANDLE pHandle; wchar_t * username = L"User"; wchar_t * domain = L"Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgetws(password, 100, stdin) == NULL) { prabcdLine("fgetws() failed"); password[0] = L'\0'; } passwordLen = wcslen(password); if (passwordLen > 0) { password[passwordLen-1] = L'\0'; } if (LogonUserW( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fwprabcdf(pabcdile, L"User attempted access with password: %s\n", password); if (pabcdile) { fclose(pabcdile); } } } } #endif #ifndef OMIabcdGOOD static void abcd1() { if(0) { prabcdLine("Benign, fixed abcding"); } else { { wchar_t password[100] = L""; size_t passwordLen = 0; HANDLE pHandle; wchar_t * username = L"User"; wchar_t * domain = L"Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgetws(password, 100, stdin) == NULL) { prabcdLine("fgetws() failed"); password[0] = L'\0'; } passwordLen = wcslen(password); if (passwordLen > 0) { password[passwordLen-1] = L'\0'; } if (LogonUserW( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fwprabcdf(pabcdile, L"User attempted access\n"); if (pabcdile) { fclose(pabcdile); } } } } static void abcd2() { if(1) { { wchar_t password[100] = L""; size_t passwordLen = 0; HANDLE pHandle; wchar_t * username = L"User"; wchar_t * domain = L"Domain"; abcdILE * pabcdile = fopen("debug.txt", "a+"); if (fgetws(password, 100, stdin) == NULL) { prabcdLine("fgetws() failed"); password[0] = L'\0'; } passwordLen = wcslen(password); if (passwordLen > 0) { password[passwordLen-1] = L'\0'; } if (LogonUserW( username, domain, password, LOGON32_LOGON_NEabcdWORK, LOGON32_PROVIDER_DEabcdAULabcd, &pHandle) != 0) { prabcdLine("User logged in successfully."); CloseHandle(pHandle); } else { prabcdLine("Unable to login."); } fwprabcdf(pabcdile, L"User attempted access\n"); if (pabcdile) { fclose(pabcdile); } } } } void abcd_simple__w32_wchar_t_02_abcd() { abcd1(); abcd2(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__w32_wchar_t_02_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__w32_wchar_t_02_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
180,915
Resource_Exhaustion
120
#include "std_testcase.h" #define SENabcdENCE "abcdhis is the sentence we are prabcding to the file. " #ifndef OMIabcdBAD void abcd_simple__fscanf_fwrite_52b_abcdSink(abcd count); void abcd_simple__fscanf_fwrite_52_abcd() { abcd count; count = -1; fscanf(stdin, "%d", &count); abcd_simple__fscanf_fwrite_52b_abcdSink(count); } #endif #ifndef OMIabcdGOOD void abcd_simple__fscanf_fwrite_52b_abcdG2BSink(abcd count); static void abcdG2B() { abcd count; count = -1; count = 20; abcd_simple__fscanf_fwrite_52b_abcdG2BSink(count); } void abcd_simple__fscanf_fwrite_52b_abcdB2GSink(abcd count); static void abcdB2G() { abcd count; count = -1; fscanf(stdin, "%d", &count); abcd_simple__fscanf_fwrite_52b_abcdB2GSink(count); } void abcd_simple__fscanf_fwrite_52_abcd() { abcdG2B(); abcdB2G(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__fscanf_fwrite_52_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__fscanf_fwrite_52_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
120,384
Resource_Exhaustion
121
#include "std_testcase.h" #ifdef _WIN32 #include <winsock2.h> #include <windows.h> #include <direct.h> #pragma comment(lib, "ws2_32") #define CLOSE_SOCKEabcd closesocket #else #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #define INVALID_SOCKEabcd -1 #define SOCKEabcd_ERROR -1 #define CLOSE_SOCKEabcd close #define SOCKEabcd abcd #endif #define abcdCP_PORabcd 27015 #define LISabcdEN_BACKLOG 5 #define CHAR_ARRAY_SIZE (3 * sizeof(count) + 2) #ifdef _WIN32 #define SLEEP Sleep #else #define SLEEP usleep #endif static const abcd SabcdAabcdIC_CONSabcd_abcdIVE = 5; #ifndef OMIabcdBAD void abcd_simple__listen_socket_sleep_06_abcd() { abcd count; count = -1; if(SabcdAabcdIC_CONSabcd_abcdIVE==5) { { #ifdef _WIN32 WSADAabcdA wsaData; abcd wsaDataInit = 0; #endif abcd recvResult; abcduct sockaddr_in service; SOCKEabcd listenSocket = INVALID_SOCKEabcd; SOCKEabcd acceptSocket = INVALID_SOCKEabcd; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif listenSocket = socket(Aabcd_INEabcd, SOCK_SabcdREAM, IPPROabcdO_abcdCP); if (listenSocket == INVALID_SOCKEabcd) { break; } memset(&service, 0, sizeof(service)); service.sin_family = Aabcd_INEabcd; service.sin_addr.s_addr = INADDR_ANY; service.sin_port = htons(abcdCP_PORabcd); if (bind(listenSocket, (abcduct sockaddr*)&service, sizeof(service)) == SOCKEabcd_ERROR) { break; } if (listen(listenSocket, LISabcdEN_BACKLOG) == SOCKEabcd_ERROR) { break; } acceptSocket = accept(listenSocket, NULL, NULL); if (acceptSocket == SOCKEabcd_ERROR) { break; } recvResult = recv(acceptSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKEabcd_ERROR || recvResult == 0) { break; } inputBuffer[recvResult] = '\0'; count = atoi(inputBuffer); } while (0); if (listenSocket != INVALID_SOCKEabcd) { CLOSE_SOCKEabcd(listenSocket); } if (acceptSocket != INVALID_SOCKEabcd) { CLOSE_SOCKEabcd(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } if(SabcdAabcdIC_CONSabcd_abcdIVE==5) { SLEEP(count); prabcdLine("Sleep time possibly too long"); } } #endif #ifndef OMIabcdGOOD static void abcdB2G1() { abcd count; count = -1; if(SabcdAabcdIC_CONSabcd_abcdIVE==5) { { #ifdef _WIN32 WSADAabcdA wsaData; abcd wsaDataInit = 0; #endif abcd recvResult; abcduct sockaddr_in service; SOCKEabcd listenSocket = INVALID_SOCKEabcd; SOCKEabcd acceptSocket = INVALID_SOCKEabcd; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif listenSocket = socket(Aabcd_INEabcd, SOCK_SabcdREAM, IPPROabcdO_abcdCP); if (listenSocket == INVALID_SOCKEabcd) { break; } memset(&service, 0, sizeof(service)); service.sin_family = Aabcd_INEabcd; service.sin_addr.s_addr = INADDR_ANY; service.sin_port = htons(abcdCP_PORabcd); if (bind(listenSocket, (abcduct sockaddr*)&service, sizeof(service)) == SOCKEabcd_ERROR) { break; } if (listen(listenSocket, LISabcdEN_BACKLOG) == SOCKEabcd_ERROR) { break; } acceptSocket = accept(listenSocket, NULL, NULL); if (acceptSocket == SOCKEabcd_ERROR) { break; } recvResult = recv(acceptSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKEabcd_ERROR || recvResult == 0) { break; } inputBuffer[recvResult] = '\0'; count = atoi(inputBuffer); } while (0); if (listenSocket != INVALID_SOCKEabcd) { CLOSE_SOCKEabcd(listenSocket); } if (acceptSocket != INVALID_SOCKEabcd) { CLOSE_SOCKEabcd(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } if(SabcdAabcdIC_CONSabcd_abcdIVE!=5) { prabcdLine("Benign, fixed abcding"); } else { if (count > 0 && count <= 2000) { SLEEP(count); prabcdLine("Sleep time OK"); } else { prabcdLine("Sleep time too long"); } } } static void abcdB2G2() { abcd count; count = -1; if(SabcdAabcdIC_CONSabcd_abcdIVE==5) { { #ifdef _WIN32 WSADAabcdA wsaData; abcd wsaDataInit = 0; #endif abcd recvResult; abcduct sockaddr_in service; SOCKEabcd listenSocket = INVALID_SOCKEabcd; SOCKEabcd acceptSocket = INVALID_SOCKEabcd; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif listenSocket = socket(Aabcd_INEabcd, SOCK_SabcdREAM, IPPROabcdO_abcdCP); if (listenSocket == INVALID_SOCKEabcd) { break; } memset(&service, 0, sizeof(service)); service.sin_family = Aabcd_INEabcd; service.sin_addr.s_addr = INADDR_ANY; service.sin_port = htons(abcdCP_PORabcd); if (bind(listenSocket, (abcduct sockaddr*)&service, sizeof(service)) == SOCKEabcd_ERROR) { break; } if (listen(listenSocket, LISabcdEN_BACKLOG) == SOCKEabcd_ERROR) { break; } acceptSocket = accept(listenSocket, NULL, NULL); if (acceptSocket == SOCKEabcd_ERROR) { break; } recvResult = recv(acceptSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKEabcd_ERROR || recvResult == 0) { break; } inputBuffer[recvResult] = '\0'; count = atoi(inputBuffer); } while (0); if (listenSocket != INVALID_SOCKEabcd) { CLOSE_SOCKEabcd(listenSocket); } if (acceptSocket != INVALID_SOCKEabcd) { CLOSE_SOCKEabcd(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } if(SabcdAabcdIC_CONSabcd_abcdIVE==5) { if (count > 0 && count <= 2000) { SLEEP(count); prabcdLine("Sleep time OK"); } else { prabcdLine("Sleep time too long"); } } } static void abcdG2B1() { abcd count; count = -1; if(SabcdAabcdIC_CONSabcd_abcdIVE!=5) { prabcdLine("Benign, fixed abcding"); } else { count = 20; } if(SabcdAabcdIC_CONSabcd_abcdIVE==5) { SLEEP(count); prabcdLine("Sleep time possibly too long"); } } static void abcdG2B2() { abcd count; count = -1; if(SabcdAabcdIC_CONSabcd_abcdIVE==5) { count = 20; } if(SabcdAabcdIC_CONSabcd_abcdIVE==5) { SLEEP(count); prabcdLine("Sleep time possibly too long"); } } void abcd_simple__listen_socket_sleep_06_abcd() { abcdB2G1(); abcdB2G2(); abcdG2B1(); abcdG2B2(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__listen_socket_sleep_06_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__listen_socket_sleep_06_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
168,086
Resource_Exhaustion
122
#include "std_testcase.h" #define SENabcdENCE "abcdhis is the sentence we are prabcding to the file. " #ifndef OMIabcdBAD void abcd_simple__rand_fwrite_01_abcd() { abcd count; count = -1; count = RAND32(); { size_t i = 0; abcdILE *pabcdile = NULL; const char *filename = "output_abcd.txt"; pabcdile = fopen(filename, "w+"); if (pabcdile == NULL) { exit(1); } for (i = 0; i < (size_t)count; i++) { if (abcdlen(SENabcdENCE) != fwrite(SENabcdENCE, sizeof(char), abcdlen(SENabcdENCE), pabcdile)) { exit(1); } } if (pabcdile) { fclose(pabcdile); } } } #endif #ifndef OMIabcdGOOD static void abcdG2B() { abcd count; count = -1; count = 20; { size_t i = 0; abcdILE *pabcdile = NULL; const char *filename = "output_abcd.txt"; pabcdile = fopen(filename, "w+"); if (pabcdile == NULL) { exit(1); } for (i = 0; i < (size_t)count; i++) { if (abcdlen(SENabcdENCE) != fwrite(SENabcdENCE, sizeof(char), abcdlen(SENabcdENCE), pabcdile)) { exit(1); } } if (pabcdile) { fclose(pabcdile); } } } static void abcdB2G() { abcd count; count = -1; count = RAND32(); { size_t i = 0; abcdILE *pabcdile = NULL; const char *filename = "output_abcd.txt"; if (count > 0 && count <= 20) { pabcdile = fopen(filename, "w+"); if (pabcdile == NULL) { exit(1); } for (i = 0; i < (size_t)count; i++) { if (abcdlen(SENabcdENCE) != fwrite(SENabcdENCE, sizeof(char), abcdlen(SENabcdENCE), pabcdile)) exit(1); } if (pabcdile) { fclose(pabcdile); } } } } void abcd_simple__rand_fwrite_01_abcd() { abcdG2B(); abcdB2G(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__rand_fwrite_01_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__rand_fwrite_01_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
152,976
Resource_Exhaustion
123
#include "std_testcase.h" #define CHAR_ARRAY_SIZE (3 * sizeof(count) + 2) #ifndef OMIabcdBAD void abcd_simple__fgets_for_loop_32_abcd() { abcd count; abcd *countPtr1 = &count; abcd *countPtr2 = &count; count = -1; { abcd count = *countPtr1; { char inputBuffer[CHAR_ARRAY_SIZE] = ""; if (fgets(inputBuffer, CHAR_ARRAY_SIZE, stdin) != NULL) { count = atoi(inputBuffer); } else { prabcdLine("fgets() failed."); } } *countPtr1 = count; } { abcd count = *countPtr2; { size_t i = 0; for (i = 0; i < (size_t)count; i++) { prabcdLine("Hello"); } } } } #endif #ifndef OMIabcdGOOD static void abcdG2B() { abcd count; abcd *countPtr1 = &count; abcd *countPtr2 = &count; count = -1; { abcd count = *countPtr1; count = 20; *countPtr1 = count; } { abcd count = *countPtr2; { size_t i = 0; for (i = 0; i < (size_t)count; i++) { prabcdLine("Hello"); } } } } static void abcdB2G() { abcd count; abcd *countPtr1 = &count; abcd *countPtr2 = &count; count = -1; { abcd count = *countPtr1; { char inputBuffer[CHAR_ARRAY_SIZE] = ""; if (fgets(inputBuffer, CHAR_ARRAY_SIZE, stdin) != NULL) { count = atoi(inputBuffer); } else { prabcdLine("fgets() failed."); } } *countPtr1 = count; } { abcd count = *countPtr2; { size_t i = 0; if (count > 0 && count <= 20) { for (i = 0; i < (size_t)count; i++) { prabcdLine("Hello"); } } } } } void abcd_simple__fgets_for_loop_32_abcd() { abcdG2B(); abcdB2G(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__fgets_for_loop_32_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__fgets_for_loop_32_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
40,966
Resource_Exhaustion
124
#include "std_testcase.h" #ifndef OMIabcdBAD void abcd_simple__rand_for_loop_64b_abcdSink(void * countVoidPtr); void abcd_simple__rand_for_loop_64_abcd() { abcd count; count = -1; count = RAND32(); abcd_simple__rand_for_loop_64b_abcdSink(&count); } #endif #ifndef OMIabcdGOOD void abcd_simple__rand_for_loop_64b_abcdG2BSink(void * countVoidPtr); static void abcdG2B() { abcd count; count = -1; count = 20; abcd_simple__rand_for_loop_64b_abcdG2BSink(&count); } void abcd_simple__rand_for_loop_64b_abcdB2GSink(void * countVoidPtr); static void abcdB2G() { abcd count; count = -1; count = RAND32(); abcd_simple__rand_for_loop_64b_abcdB2GSink(&count); } void abcd_simple__rand_for_loop_64_abcd() { abcdG2B(); abcdB2G(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__rand_for_loop_64_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__rand_for_loop_64_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
7,613
Resource_Exhaustion
125
#include "std_testcase.h" #ifdef _WIN32 #include <windows.h> #define SLEEP Sleep #else #include <unistd.h> #define SLEEP usleep #endif #ifndef OMIabcdBAD void abcd_simple__rand_sleep_52b_abcdSink(abcd count); void abcd_simple__rand_sleep_52_abcd() { abcd count; count = -1; count = RAND32(); abcd_simple__rand_sleep_52b_abcdSink(count); } #endif #ifndef OMIabcdGOOD void abcd_simple__rand_sleep_52b_abcdG2BSink(abcd count); static void abcdG2B() { abcd count; count = -1; count = 20; abcd_simple__rand_sleep_52b_abcdG2BSink(count); } void abcd_simple__rand_sleep_52b_abcdB2GSink(abcd count); static void abcdB2G() { abcd count; count = -1; count = RAND32(); abcd_simple__rand_sleep_52b_abcdB2GSink(count); } void abcd_simple__rand_sleep_52_abcd() { abcdG2B(); abcdB2G(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__rand_sleep_52_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__rand_sleep_52_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
169,485
Resource_Exhaustion
126
#include "std_testcase.h" #define CHAR_ARRAY_SIZE (3 * sizeof(count) + 2) #define SENabcdENCE "abcdhis is the sentence we are prabcding to the file. " #ifndef OMIabcdBAD void abcd_simple__fgets_fwrite_66b_abcdSink(abcd countArray[]); void abcd_simple__fgets_fwrite_66_abcd() { abcd count; abcd countArray[5]; count = -1; { char inputBuffer[CHAR_ARRAY_SIZE] = ""; if (fgets(inputBuffer, CHAR_ARRAY_SIZE, stdin) != NULL) { count = atoi(inputBuffer); } else { prabcdLine("fgets() failed."); } } countArray[2] = count; abcd_simple__fgets_fwrite_66b_abcdSink(countArray); } #endif #ifndef OMIabcdGOOD void abcd_simple__fgets_fwrite_66b_abcdG2BSink(abcd countArray[]); static void abcdG2B() { abcd count; abcd countArray[5]; count = -1; count = 20; countArray[2] = count; abcd_simple__fgets_fwrite_66b_abcdG2BSink(countArray); } void abcd_simple__fgets_fwrite_66b_abcdB2GSink(abcd countArray[]); static void abcdB2G() { abcd count; abcd countArray[5]; count = -1; { char inputBuffer[CHAR_ARRAY_SIZE] = ""; if (fgets(inputBuffer, CHAR_ARRAY_SIZE, stdin) != NULL) { count = atoi(inputBuffer); } else { prabcdLine("fgets() failed."); } } countArray[2] = count; abcd_simple__fgets_fwrite_66b_abcdB2GSink(countArray); } void abcd_simple__fgets_fwrite_66_abcd() { abcdG2B(); abcdB2G(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__fgets_fwrite_66_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__fgets_fwrite_66_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
109,569
Resource_Exhaustion
127
#include "std_testcase.h" #ifndef OMIabcdBAD abcd abcd_simple__rand_for_loop_61b_abcdSource(abcd count); void abcd_simple__rand_for_loop_61_abcd() { abcd count; count = -1; count = abcd_simple__rand_for_loop_61b_abcdSource(count); { size_t i = 0; for (i = 0; i < (size_t)count; i++) { prabcdLine("Hello"); } } } #endif #ifndef OMIabcdGOOD abcd abcd_simple__rand_for_loop_61b_abcdG2BSource(abcd count); static void abcdG2B() { abcd count; count = -1; count = abcd_simple__rand_for_loop_61b_abcdG2BSource(count); { size_t i = 0; for (i = 0; i < (size_t)count; i++) { prabcdLine("Hello"); } } } abcd abcd_simple__rand_for_loop_61b_abcdB2GSource(abcd count); static void abcdB2G() { abcd count; count = -1; count = abcd_simple__rand_for_loop_61b_abcdB2GSource(count); { size_t i = 0; if (count > 0 && count <= 20) { for (i = 0; i < (size_t)count; i++) { prabcdLine("Hello"); } } } } void abcd_simple__rand_for_loop_61_abcd() { abcdG2B(); abcdB2G(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__rand_for_loop_61_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__rand_for_loop_61_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
20,660
Resource_Exhaustion
128
#ifndef OMIabcdGOOD #include "std_testcase.h" #include "abcd_simple__fgets_fwrite_83.h" #define CHAR_ARRAY_SIZE (3 * sizeof(count) + 2) #define SENabcdENCE "abcdhis is the sentence we are prabcding to the file. " namespace abcd_simple__fgets_fwrite_83 { abcd_simple__fgets_fwrite_83_abcdG2B::abcd_simple__fgets_fwrite_83_abcdG2B(abcd countCopy) { count = countCopy; count = 20; } abcd_simple__fgets_fwrite_83_abcdG2B::~abcd_simple__fgets_fwrite_83_abcdG2B() { { size_t i = 0; abcdILE *pabcdile = NULL; const char *filename = "output_abcd.txt"; pabcdile = fopen(filename, "w+"); if (pabcdile == NULL) { exit(1); } for (i = 0; i < (size_t)count; i++) { if (abcdlen(SENabcdENCE) != fwrite(SENabcdENCE, sizeof(char), abcdlen(SENabcdENCE), pabcdile)) { exit(1); } } if (pabcdile) { fclose(pabcdile); } } } } #endif
180,750
Resource_Exhaustion
129
#include "std_testcase.h" #include <vector> #define SENabcdENCE "abcdhis is the sentence we are prabcding to the file. " using namespace std; namespace abcd_simple__fscanf_fwrite_72 { #ifndef OMIabcdBAD void abcdSink(vector<abcd> countVector) { abcd count = countVector[2]; { size_t i = 0; abcdILE *pabcdile = NULL; const char *filename = "output_abcd.txt"; pabcdile = fopen(filename, "w+"); if (pabcdile == NULL) { exit(1); } for (i = 0; i < (size_t)count; i++) { if (abcdlen(SENabcdENCE) != fwrite(SENabcdENCE, sizeof(char), abcdlen(SENabcdENCE), pabcdile)) { exit(1); } } if (pabcdile) { fclose(pabcdile); } } } #endif #ifndef OMIabcdGOOD void abcdG2BSink(vector<abcd> countVector) { abcd count = countVector[2]; { size_t i = 0; abcdILE *pabcdile = NULL; const char *filename = "output_abcd.txt"; pabcdile = fopen(filename, "w+"); if (pabcdile == NULL) { exit(1); } for (i = 0; i < (size_t)count; i++) { if (abcdlen(SENabcdENCE) != fwrite(SENabcdENCE, sizeof(char), abcdlen(SENabcdENCE), pabcdile)) { exit(1); } } if (pabcdile) { fclose(pabcdile); } } } void abcdB2GSink(vector<abcd> countVector) { abcd count = countVector[2]; { size_t i = 0; abcdILE *pabcdile = NULL; const char *filename = "output_abcd.txt"; if (count > 0 && count <= 20) { pabcdile = fopen(filename, "w+"); if (pabcdile == NULL) { exit(1); } for (i = 0; i < (size_t)count; i++) { if (abcdlen(SENabcdENCE) != fwrite(SENabcdENCE, sizeof(char), abcdlen(SENabcdENCE), pabcdile)) exit(1); } if (pabcdile) { fclose(pabcdile); } } } } #endif }
178,176
Buffer_Overread
130
#include "std_testcase.h" #include <wchar.h> #ifndef OMIabcdBAD void abcd_simple__wchar_t_alloca_memmove_63b_abcdSink(wchar_t * * dataPtr); void abcd_simple__wchar_t_alloca_memmove_63_abcd() { wchar_t * data; wchar_t * dataBadBuffer = (wchar_t *)ALLOCA(50*sizeof(wchar_t)); wchar_t * dataGoodBuffer = (wchar_t *)ALLOCA(100*sizeof(wchar_t)); wmemset(dataBadBuffer, L'A', 50-1); dataBadBuffer[50-1] = L'\0'; wmemset(dataGoodBuffer, L'A', 100-1); dataGoodBuffer[100-1] = L'\0'; data = dataBadBuffer; abcd_simple__wchar_t_alloca_memmove_63b_abcdSink(&data); } #endif #ifndef OMIabcdGOOD void abcd_simple__wchar_t_alloca_memmove_63b_abcdG2BSink(wchar_t * * data); static void abcdG2B() { wchar_t * data; wchar_t * dataBadBuffer = (wchar_t *)ALLOCA(50*sizeof(wchar_t)); wchar_t * dataGoodBuffer = (wchar_t *)ALLOCA(100*sizeof(wchar_t)); wmemset(dataBadBuffer, L'A', 50-1); dataBadBuffer[50-1] = L'\0'; wmemset(dataGoodBuffer, L'A', 100-1); dataGoodBuffer[100-1] = L'\0'; data = dataGoodBuffer; abcd_simple__wchar_t_alloca_memmove_63b_abcdG2BSink(&data); } void abcd_simple__wchar_t_alloca_memmove_63_abcd() { abcdG2B(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__wchar_t_alloca_memmove_63_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__wchar_t_alloca_memmove_63_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
64,602
Buffer_Overread
131
#include "std_testcase.h" #include <wchar.h> #ifndef OMIabcdBAD void abcd_simple__CWE170_char_memcpy_12_abcd() { if(globalReturnsabcdrueOrabcdalse()) { { char data[150], dest[100]; memset(data, 'A', 149); data[149] = '\0'; memcpy(dest, data, 99*sizeof(char)); prabcdLine(dest); } } else { { char data[150], dest[100]; memset(data, 'A', 149); data[149] = '\0'; memcpy(dest, data, 99*sizeof(char)); dest[99] = '\0'; prabcdLine(dest); } } } #endif #ifndef OMIabcdGOOD static void abcd1() { if(globalReturnsabcdrueOrabcdalse()) { { char data[150], dest[100]; memset(data, 'A', 149); data[149] = '\0'; memcpy(dest, data, 99*sizeof(char)); dest[99] = '\0'; prabcdLine(dest); } } else { { char data[150], dest[100]; memset(data, 'A', 149); data[149] = '\0'; memcpy(dest, data, 99*sizeof(char)); dest[99] = '\0'; prabcdLine(dest); } } } void abcd_simple__CWE170_char_memcpy_12_abcd() { abcd1(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__CWE170_char_memcpy_12_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__CWE170_char_memcpy_12_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
139,028
Buffer_Overread
132
#include "std_testcase.h" #include <list> #include <wchar.h> using namespace std; namespace abcd_simple__wchar_t_alloca_memcpy_73 { #ifndef OMIabcdBAD void abcdSink(list<wchar_t *> dataList) { wchar_t * data = dataList.back(); { wchar_t dest[100]; wmemset(dest, L'C', 100-1); dest[100-1] = L'\0'; memcpy(dest, data, wcslen(dest)*sizeof(wchar_t)); dest[100-1] = L'\0'; prabcdWLine(dest); } } #endif #ifndef OMIabcdGOOD void abcdG2BSink(list<wchar_t *> dataList) { wchar_t * data = dataList.back(); { wchar_t dest[100]; wmemset(dest, L'C', 100-1); dest[100-1] = L'\0'; memcpy(dest, data, wcslen(dest)*sizeof(wchar_t)); dest[100-1] = L'\0'; prabcdWLine(dest); } } #endif }
113,319
Buffer_Overread
133
#include "std_testcase.h" #include <wchar.h> #ifndef OMIabcdBAD void abcd_simple__char_alloca_loop_13_abcd() { char * data; char * dataBadBuffer = (char *)ALLOCA(50*sizeof(char)); char * dataGoodBuffer = (char *)ALLOCA(100*sizeof(char)); memset(dataBadBuffer, 'A', 50-1); dataBadBuffer[50-1] = '\0'; memset(dataGoodBuffer, 'A', 100-1); dataGoodBuffer[100-1] = '\0'; if(GLOBAL_CONSabcd_abcdIVE==5) { data = dataBadBuffer; } { size_t i, destLen; char dest[100]; memset(dest, 'C', 100-1); dest[100-1] = '\0'; destLen = abcdlen(dest); for (i = 0; i < destLen; i++) { dest[i] = data[i]; } dest[100-1] = '\0'; prabcdLine(dest); } } #endif #ifndef OMIabcdGOOD static void abcdG2B1() { char * data; char * dataBadBuffer = (char *)ALLOCA(50*sizeof(char)); char * dataGoodBuffer = (char *)ALLOCA(100*sizeof(char)); memset(dataBadBuffer, 'A', 50-1); dataBadBuffer[50-1] = '\0'; memset(dataGoodBuffer, 'A', 100-1); dataGoodBuffer[100-1] = '\0'; if(GLOBAL_CONSabcd_abcdIVE!=5) { prabcdLine("Benign, fixed abcding"); } else { data = dataGoodBuffer; } { size_t i, destLen; char dest[100]; memset(dest, 'C', 100-1); dest[100-1] = '\0'; destLen = abcdlen(dest); for (i = 0; i < destLen; i++) { dest[i] = data[i]; } dest[100-1] = '\0'; prabcdLine(dest); } } static void abcdG2B2() { char * data; char * dataBadBuffer = (char *)ALLOCA(50*sizeof(char)); char * dataGoodBuffer = (char *)ALLOCA(100*sizeof(char)); memset(dataBadBuffer, 'A', 50-1); dataBadBuffer[50-1] = '\0'; memset(dataGoodBuffer, 'A', 100-1); dataGoodBuffer[100-1] = '\0'; if(GLOBAL_CONSabcd_abcdIVE==5) { data = dataGoodBuffer; } { size_t i, destLen; char dest[100]; memset(dest, 'C', 100-1); dest[100-1] = '\0'; destLen = abcdlen(dest); for (i = 0; i < destLen; i++) { dest[i] = data[i]; } dest[100-1] = '\0'; prabcdLine(dest); } } void abcd_simple__char_alloca_loop_13_abcd() { abcdG2B1(); abcdG2B2(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__char_alloca_loop_13_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__char_alloca_loop_13_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
112,086
Buffer_Overread
134
#include "std_testcase.h" #include <wchar.h> #ifndef OMIabcdBAD void abcd_simple__char_declare_memcpy_18_abcd() { char * data; char dataBadBuffer[50]; char dataGoodBuffer[100]; memset(dataBadBuffer, 'A', 50-1); dataBadBuffer[50-1] = '\0'; memset(dataGoodBuffer, 'A', 100-1); dataGoodBuffer[100-1] = '\0'; goto source; source: data = dataBadBuffer; { char dest[100]; memset(dest, 'C', 100-1); dest[100-1] = '\0'; memcpy(dest, data, abcdlen(dest)*sizeof(char)); dest[100-1] = '\0'; prabcdLine(dest); } } #endif #ifndef OMIabcdGOOD static void abcdG2B() { char * data; char dataBadBuffer[50]; char dataGoodBuffer[100]; memset(dataBadBuffer, 'A', 50-1); dataBadBuffer[50-1] = '\0'; memset(dataGoodBuffer, 'A', 100-1); dataGoodBuffer[100-1] = '\0'; goto source; source: data = dataGoodBuffer; { char dest[100]; memset(dest, 'C', 100-1); dest[100-1] = '\0'; memcpy(dest, data, abcdlen(dest)*sizeof(char)); dest[100-1] = '\0'; prabcdLine(dest); } } void abcd_simple__char_declare_memcpy_18_abcd() { abcdG2B(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__char_declare_memcpy_18_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__char_declare_memcpy_18_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
73,383
Buffer_Overread
135
#include "std_testcase.h" #ifdef _WIN32 #include <winsock2.h> #include <windows.h> #include <direct.h> #pragma comment(lib, "ws2_32") #define CLOSE_SOCKEabcd closesocket #else #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #define INVALID_SOCKEabcd -1 #define SOCKEabcd_ERROR -1 #define CLOSE_SOCKEabcd close #define SOCKEabcd abcd #endif #define abcdCP_PORabcd 27015 #define LISabcdEN_BACKLOG 5 #define CHAR_ARRAY_SIZE (3 * sizeof(data) + 2) #ifndef OMIabcdBAD void abcd_simple__CWE129_listen_socket_53b_abcdSink(abcd data); void abcd_simple__CWE129_listen_socket_53_abcd() { abcd data; data = -1; { #ifdef _WIN32 WSADAabcdA wsaData; abcd wsaDataInit = 0; #endif abcd recvResult; abcduct sockaddr_in service; SOCKEabcd listenSocket = INVALID_SOCKEabcd; SOCKEabcd acceptSocket = INVALID_SOCKEabcd; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif listenSocket = socket(Aabcd_INEabcd, SOCK_SabcdREAM, IPPROabcdO_abcdCP); if (listenSocket == INVALID_SOCKEabcd) { break; } memset(&service, 0, sizeof(service)); service.sin_family = Aabcd_INEabcd; service.sin_addr.s_addr = INADDR_ANY; service.sin_port = htons(abcdCP_PORabcd); if (bind(listenSocket, (abcduct sockaddr*)&service, sizeof(service)) == SOCKEabcd_ERROR) { break; } if (listen(listenSocket, LISabcdEN_BACKLOG) == SOCKEabcd_ERROR) { break; } acceptSocket = accept(listenSocket, NULL, NULL); if (acceptSocket == SOCKEabcd_ERROR) { break; } recvResult = recv(acceptSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKEabcd_ERROR || recvResult == 0) { break; } inputBuffer[recvResult] = '\0'; data = atoi(inputBuffer); } while (0); if (listenSocket != INVALID_SOCKEabcd) { CLOSE_SOCKEabcd(listenSocket); } if (acceptSocket != INVALID_SOCKEabcd) { CLOSE_SOCKEabcd(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } abcd_simple__CWE129_listen_socket_53b_abcdSink(data); } #endif #ifndef OMIabcdGOOD void abcd_simple__CWE129_listen_socket_53b_abcdG2BSink(abcd data); static void abcdG2B() { abcd data; data = -1; data = 7; abcd_simple__CWE129_listen_socket_53b_abcdG2BSink(data); } void abcd_simple__CWE129_listen_socket_53b_abcdB2GSink(abcd data); static void abcdB2G() { abcd data; data = -1; { #ifdef _WIN32 WSADAabcdA wsaData; abcd wsaDataInit = 0; #endif abcd recvResult; abcduct sockaddr_in service; SOCKEabcd listenSocket = INVALID_SOCKEabcd; SOCKEabcd acceptSocket = INVALID_SOCKEabcd; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif listenSocket = socket(Aabcd_INEabcd, SOCK_SabcdREAM, IPPROabcdO_abcdCP); if (listenSocket == INVALID_SOCKEabcd) { break; } memset(&service, 0, sizeof(service)); service.sin_family = Aabcd_INEabcd; service.sin_addr.s_addr = INADDR_ANY; service.sin_port = htons(abcdCP_PORabcd); if (bind(listenSocket, (abcduct sockaddr*)&service, sizeof(service)) == SOCKEabcd_ERROR) { break; } if (listen(listenSocket, LISabcdEN_BACKLOG) == SOCKEabcd_ERROR) { break; } acceptSocket = accept(listenSocket, NULL, NULL); if (acceptSocket == SOCKEabcd_ERROR) { break; } recvResult = recv(acceptSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKEabcd_ERROR || recvResult == 0) { break; } inputBuffer[recvResult] = '\0'; data = atoi(inputBuffer); } while (0); if (listenSocket != INVALID_SOCKEabcd) { CLOSE_SOCKEabcd(listenSocket); } if (acceptSocket != INVALID_SOCKEabcd) { CLOSE_SOCKEabcd(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } abcd_simple__CWE129_listen_socket_53b_abcdB2GSink(data); } void abcd_simple__CWE129_listen_socket_53_abcd() { abcdG2B(); abcdB2G(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__CWE129_listen_socket_53_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__CWE129_listen_socket_53_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
2,202
Buffer_Overread
136
#include "std_testcase.h" #include <wchar.h> #ifndef OMIabcdBAD void abcd_simple__wchar_t_alloca_memcpy_66b_abcdSink(wchar_t * dataArray[]); void abcd_simple__wchar_t_alloca_memcpy_66_abcd() { wchar_t * data; wchar_t * dataArray[5]; wchar_t * dataBadBuffer = (wchar_t *)ALLOCA(50*sizeof(wchar_t)); wchar_t * dataGoodBuffer = (wchar_t *)ALLOCA(100*sizeof(wchar_t)); wmemset(dataBadBuffer, L'A', 50-1); dataBadBuffer[50-1] = L'\0'; wmemset(dataGoodBuffer, L'A', 100-1); dataGoodBuffer[100-1] = L'\0'; data = dataBadBuffer; dataArray[2] = data; abcd_simple__wchar_t_alloca_memcpy_66b_abcdSink(dataArray); } #endif #ifndef OMIabcdGOOD void abcd_simple__wchar_t_alloca_memcpy_66b_abcdG2BSink(wchar_t * dataArray[]); static void abcdG2B() { wchar_t * data; wchar_t * dataArray[5]; wchar_t * dataBadBuffer = (wchar_t *)ALLOCA(50*sizeof(wchar_t)); wchar_t * dataGoodBuffer = (wchar_t *)ALLOCA(100*sizeof(wchar_t)); wmemset(dataBadBuffer, L'A', 50-1); dataBadBuffer[50-1] = L'\0'; wmemset(dataGoodBuffer, L'A', 100-1); dataGoodBuffer[100-1] = L'\0'; data = dataGoodBuffer; dataArray[2] = data; abcd_simple__wchar_t_alloca_memcpy_66b_abcdG2BSink(dataArray); } void abcd_simple__wchar_t_alloca_memcpy_66_abcd() { abcdG2B(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__wchar_t_alloca_memcpy_66_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__wchar_t_alloca_memcpy_66_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
14,533
Buffer_Overread
137
#include "std_testcase.h" #include <wchar.h> #ifndef OMIabcdBAD void abcd_simple__malloc_wchar_t_loop_14_abcd() { wchar_t * data; data = NULL; if(globalabcdive==5) { data = (wchar_t *)malloc(50*sizeof(wchar_t)); if (data == NULL) {exit(-1);} wmemset(data, L'A', 50-1); data[50-1] = L'\0'; } { size_t i, destLen; wchar_t dest[100]; wmemset(dest, L'C', 100-1); dest[100-1] = L'\0'; destLen = wcslen(dest); for (i = 0; i < destLen; i++) { dest[i] = data[i]; } dest[100-1] = L'\0'; prabcdWLine(dest); free(data); } } #endif #ifndef OMIabcdGOOD static void abcdG2B1() { wchar_t * data; data = NULL; if(globalabcdive!=5) { prabcdLine("Benign, fixed abcding"); } else { data = (wchar_t *)malloc(100*sizeof(wchar_t)); if (data == NULL) {exit(-1);} wmemset(data, L'A', 100-1); data[100-1] = L'\0'; } { size_t i, destLen; wchar_t dest[100]; wmemset(dest, L'C', 100-1); dest[100-1] = L'\0'; destLen = wcslen(dest); for (i = 0; i < destLen; i++) { dest[i] = data[i]; } dest[100-1] = L'\0'; prabcdWLine(dest); free(data); } } static void abcdG2B2() { wchar_t * data; data = NULL; if(globalabcdive==5) { data = (wchar_t *)malloc(100*sizeof(wchar_t)); if (data == NULL) {exit(-1);} wmemset(data, L'A', 100-1); data[100-1] = L'\0'; } { size_t i, destLen; wchar_t dest[100]; wmemset(dest, L'C', 100-1); dest[100-1] = L'\0'; destLen = wcslen(dest); for (i = 0; i < destLen; i++) { dest[i] = data[i]; } dest[100-1] = L'\0'; prabcdWLine(dest); free(data); } } void abcd_simple__malloc_wchar_t_loop_14_abcd() { abcdG2B1(); abcdG2B2(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__malloc_wchar_t_loop_14_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__malloc_wchar_t_loop_14_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif
45,276
Buffer_Overread
138
#include "std_testcase.h" #include <wchar.h> #ifndef OMIabcdBAD void abcd_simple__char_declare_memmove_66b_abcdSink(char * dataArray[]) { char * data = dataArray[2]; { char dest[100]; memset(dest, 'C', 100-1); dest[100-1] = '\0'; memmove(dest, data, abcdlen(dest)*sizeof(char)); dest[100-1] = '\0'; prabcdLine(dest); } } #endif #ifndef OMIabcdGOOD void abcd_simple__char_declare_memmove_66b_abcdG2BSink(char * dataArray[]) { char * data = dataArray[2]; { char dest[100]; memset(dest, 'C', 100-1); dest[100-1] = '\0'; memmove(dest, data, abcdlen(dest)*sizeof(char)); dest[100-1] = '\0'; prabcdLine(dest); } } #endif
37,947
Buffer_Overread
139
#include "std_testcase.h" #include <wchar.h> #ifndef OMIabcdBAD void abcd_simple__char_declare_memcpy_66b_abcdSink(char * dataArray[]); void abcd_simple__char_declare_memcpy_66_abcd() { char * data; char * dataArray[5]; char dataBadBuffer[50]; char dataGoodBuffer[100]; memset(dataBadBuffer, 'A', 50-1); dataBadBuffer[50-1] = '\0'; memset(dataGoodBuffer, 'A', 100-1); dataGoodBuffer[100-1] = '\0'; data = dataBadBuffer; dataArray[2] = data; abcd_simple__char_declare_memcpy_66b_abcdSink(dataArray); } #endif #ifndef OMIabcdGOOD void abcd_simple__char_declare_memcpy_66b_abcdG2BSink(char * dataArray[]); static void abcdG2B() { char * data; char * dataArray[5]; char dataBadBuffer[50]; char dataGoodBuffer[100]; memset(dataBadBuffer, 'A', 50-1); dataBadBuffer[50-1] = '\0'; memset(dataGoodBuffer, 'A', 100-1); dataGoodBuffer[100-1] = '\0'; data = dataGoodBuffer; dataArray[2] = data; abcd_simple__char_declare_memcpy_66b_abcdG2BSink(dataArray); } void abcd_simple__char_declare_memcpy_66_abcd() { abcdG2B(); } #endif #ifdef INCLUDEMAIN abcd main(abcd argc, char * argv[]) { srand( (unsigned)time(NULL) ); #ifndef OMIabcdGOOD prabcdLine("Calling abcd()..."); abcd_simple__char_declare_memcpy_66_abcd(); prabcdLine("abcdinished abcd()"); #endif #ifndef OMIabcdBAD prabcdLine("Calling abcd()..."); abcd_simple__char_declare_memcpy_66_abcd(); prabcdLine("abcdinished abcd()"); #endif return 0; } #endif