Unnamed: 0
int64 0
56k
| source_code
stringlengths 55
5.98k
| comments
stringlengths 2
1.76k
| label
stringclasses 68
values | dataset_name
stringclasses 1
value | file_name
stringlengths 208
265
| function
stringlengths 27
87
| decompiled_code
stringlengths 68
3.97k
| compiler_options
stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|
53,900
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_12_good()
{
goodB2G();
goodG2B();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98540/CWE400_Resource_Exhaustion__connect_socket_fwrite_12.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_12_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_12_good(void)
{
goodB2G();
goodG2B();
return;
}
|
['gcc']
|
53,901
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_13_bad()
{
int count;
/* Initialize count */
count = -1;
if(GLOBAL_CONST_FIVE==5)
{
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
}
if(GLOBAL_CONST_FIVE==5)
{
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
}
|
['/* Initialize count */', '/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */', '/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98541/CWE400_Resource_Exhaustion__connect_socket_fwrite_13.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_13_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_13_bad(void)
{
int iVar1;
long lVar2;
undefined auStack_56 [14];
undefined2 uStack_48;
undefined2 uStack_46;
undefined4 uStack_44;
undefined *puStack_30;
long lStack_28;
int iStack_20;
int iStack_1c;
ulong uStack_18;
int iStack_c;
iStack_c = -1;
if (GLOBAL_CONST_FIVE == 5) {
iStack_1c = 0xffffffff;
iStack_1c = func_0x00400e20(2,1,6);
if (iStack_1c != -1) {
func_0x00400d10(&uStack_48,0,0x10);
uStack_48 = 2;
uStack_44 = func_0x00400d60(&UNK_00401618);
uStack_46 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_1c,&uStack_48,0x10);
if (((iVar1 != -1) &&
(iStack_20 = func_0x00400cb0(iStack_1c,auStack_56,0xd,0), iStack_20 != -1)) &&
(iStack_20 != 0)) {
auStack_56[iStack_20] = 0;
iStack_c = func_0x00400dc0(auStack_56);
}
}
if (iStack_1c != -1) {
func_0x00400d20(iStack_1c);
}
}
if (GLOBAL_CONST_FIVE == 5) {
uStack_18 = 0;
lStack_28 = 0;
puStack_30 = &UNK_00401622;
lStack_28 = func_0x00400db0(&UNK_00401622,&UNK_00401631);
if (lStack_28 == 0) {
func_0x00400dd0(1);
}
for (uStack_18 = 0; uStack_18 < (ulong)(long)iStack_c; uStack_18 = uStack_18 + 1) {
lVar2 = func_0x00400df0(&UNK_00401638,1,0x32,lStack_28);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lStack_28 != 0) {
func_0x00400ce0(lStack_28);
}
}
return;
}
|
['gcc']
|
53,902
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_13_good()
{
goodB2G1();
goodB2G2();
goodG2B1();
goodG2B2();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98541/CWE400_Resource_Exhaustion__connect_socket_fwrite_13.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_13_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_13_good(void)
{
goodB2G1();
goodB2G2();
goodG2B1();
goodG2B2();
return;
}
|
['gcc']
|
53,903
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_14_bad()
{
int count;
/* Initialize count */
count = -1;
if(globalFive==5)
{
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
}
if(globalFive==5)
{
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
}
|
['/* Initialize count */', '/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */', '/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98542/CWE400_Resource_Exhaustion__connect_socket_fwrite_14.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_14_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_14_bad(void)
{
int iVar1;
long lVar2;
undefined auStack_56 [14];
undefined2 uStack_48;
undefined2 uStack_46;
undefined4 uStack_44;
undefined *puStack_30;
long lStack_28;
int iStack_20;
int iStack_1c;
ulong uStack_18;
int iStack_c;
iStack_c = -1;
if (globalFive == 5) {
iStack_1c = 0xffffffff;
iStack_1c = func_0x00400e20(2,1,6);
if (iStack_1c != -1) {
func_0x00400d10(&uStack_48,0,0x10);
uStack_48 = 2;
uStack_44 = func_0x00400d60(&UNK_00401618);
uStack_46 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_1c,&uStack_48,0x10);
if (((iVar1 != -1) &&
(iStack_20 = func_0x00400cb0(iStack_1c,auStack_56,0xd,0), iStack_20 != -1)) &&
(iStack_20 != 0)) {
auStack_56[iStack_20] = 0;
iStack_c = func_0x00400dc0(auStack_56);
}
}
if (iStack_1c != -1) {
func_0x00400d20(iStack_1c);
}
}
if (globalFive == 5) {
uStack_18 = 0;
lStack_28 = 0;
puStack_30 = &UNK_00401622;
lStack_28 = func_0x00400db0(&UNK_00401622,&UNK_00401631);
if (lStack_28 == 0) {
func_0x00400dd0(1);
}
for (uStack_18 = 0; uStack_18 < (ulong)(long)iStack_c; uStack_18 = uStack_18 + 1) {
lVar2 = func_0x00400df0(&UNK_00401638,1,0x32,lStack_28);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lStack_28 != 0) {
func_0x00400ce0(lStack_28);
}
}
return;
}
|
['gcc']
|
53,904
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_14_good()
{
goodB2G1();
goodB2G2();
goodG2B1();
goodG2B2();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98542/CWE400_Resource_Exhaustion__connect_socket_fwrite_14.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_14_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_14_good(void)
{
goodB2G1();
goodB2G2();
goodG2B1();
goodG2B2();
return;
}
|
['gcc']
|
53,905
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_15_bad()
{
int count;
/* Initialize count */
count = -1;
switch(6)
{
case 6:
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
switch(7)
{
case 7:
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
}
|
['/* Initialize count */', '/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */', '/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */', '/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */', '/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98543/CWE400_Resource_Exhaustion__connect_socket_fwrite_15.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_15_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_15_bad(void)
{
int iVar1;
long lVar2;
undefined auStack_56 [14];
undefined2 uStack_48;
undefined2 uStack_46;
undefined4 uStack_44;
undefined *puStack_30;
long lStack_28;
int iStack_20;
int iStack_1c;
ulong uStack_18;
int iStack_c;
iStack_c = -1;
iStack_1c = 0xffffffff;
iStack_1c = func_0x00400e20(2,1,6);
if (iStack_1c != -1) {
func_0x00400d10(&uStack_48,0,0x10);
uStack_48 = 2;
uStack_44 = func_0x00400d60(&UNK_004015f8);
uStack_46 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_1c,&uStack_48,0x10);
if (((iVar1 != -1) && (iStack_20 = func_0x00400cb0(iStack_1c,auStack_56,0xd,0), iStack_20 != -1)
) && (iStack_20 != 0)) {
auStack_56[iStack_20] = 0;
iStack_c = func_0x00400dc0(auStack_56);
}
}
if (iStack_1c != -1) {
func_0x00400d20(iStack_1c);
}
uStack_18 = 0;
lStack_28 = 0;
puStack_30 = &UNK_00401602;
lStack_28 = func_0x00400db0(&UNK_00401602,&UNK_00401611);
if (lStack_28 == 0) {
func_0x00400dd0(1);
}
for (uStack_18 = 0; uStack_18 < (ulong)(long)iStack_c; uStack_18 = uStack_18 + 1) {
lVar2 = func_0x00400df0(&UNK_00401618,1,0x32,lStack_28);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lStack_28 != 0) {
func_0x00400ce0(lStack_28);
}
return;
}
|
['gcc']
|
53,906
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_15_good()
{
goodB2G1();
goodB2G2();
goodG2B1();
goodG2B2();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98543/CWE400_Resource_Exhaustion__connect_socket_fwrite_15.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_15_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_15_good(void)
{
goodB2G1();
goodB2G2();
goodG2B1();
goodG2B2();
return;
}
|
['gcc']
|
53,907
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_16_bad()
{
int count;
/* Initialize count */
count = -1;
while(1)
{
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
break;
}
while(1)
{
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
break;
}
}
|
['/* Initialize count */', '/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */', '/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98544/CWE400_Resource_Exhaustion__connect_socket_fwrite_16.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_16_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_16_bad(void)
{
int iVar1;
long lVar2;
undefined auStack_56 [14];
undefined2 uStack_48;
undefined2 uStack_46;
undefined4 uStack_44;
undefined *puStack_30;
long lStack_28;
int iStack_20;
int iStack_1c;
ulong uStack_18;
int iStack_c;
iStack_c = -1;
iStack_1c = 0xffffffff;
iStack_1c = func_0x00400e20(2,1,6);
if (iStack_1c != -1) {
func_0x00400d10(&uStack_48,0,0x10);
uStack_48 = 2;
uStack_44 = func_0x00400d60(&UNK_004015f8);
uStack_46 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_1c,&uStack_48,0x10);
if (((iVar1 != -1) && (iStack_20 = func_0x00400cb0(iStack_1c,auStack_56,0xd,0), iStack_20 != -1)
) && (iStack_20 != 0)) {
auStack_56[iStack_20] = 0;
iStack_c = func_0x00400dc0(auStack_56);
}
}
if (iStack_1c != -1) {
func_0x00400d20(iStack_1c);
}
uStack_18 = 0;
lStack_28 = 0;
puStack_30 = &UNK_00401602;
lStack_28 = func_0x00400db0(&UNK_00401602,&UNK_00401611);
if (lStack_28 == 0) {
func_0x00400dd0(1);
}
for (uStack_18 = 0; uStack_18 < (ulong)(long)iStack_c; uStack_18 = uStack_18 + 1) {
lVar2 = func_0x00400df0(&UNK_00401618,1,0x32,lStack_28);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lStack_28 != 0) {
func_0x00400ce0(lStack_28);
}
return;
}
|
['gcc']
|
53,908
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_16_good()
{
goodB2G();
goodG2B();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98544/CWE400_Resource_Exhaustion__connect_socket_fwrite_16.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_16_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_16_good(void)
{
goodB2G();
goodG2B();
return;
}
|
['gcc']
|
53,909
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_17_bad()
{
int i,j;
int count;
/* Initialize count */
count = -1;
for(i = 0; i < 1; i++)
{
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
}
for(j = 0; j < 1; j++)
{
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
}
|
['/* Initialize count */', '/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */', '/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98545/CWE400_Resource_Exhaustion__connect_socket_fwrite_17.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_17_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_17_bad(void)
{
int iVar1;
long lVar2;
undefined auStack_56 [14];
undefined2 uStack_48;
undefined2 uStack_46;
undefined4 uStack_44;
int iStack_38;
int iStack_34;
undefined *puStack_30;
long lStack_28;
ulong uStack_20;
int iStack_14;
int iStack_10;
int iStack_c;
iStack_14 = -1;
for (iStack_c = 0; iStack_c < 1; iStack_c = iStack_c + 1) {
iStack_34 = 0xffffffff;
iStack_34 = func_0x00400e20(2,1,6);
if (iStack_34 != -1) {
func_0x00400d10(&uStack_48,0,0x10);
uStack_48 = 2;
uStack_44 = func_0x00400d60(&UNK_00401638);
uStack_46 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_34,&uStack_48,0x10);
if (((iVar1 != -1) &&
(iStack_38 = func_0x00400cb0(iStack_34,auStack_56,0xd,0), iStack_38 != -1)) &&
(iStack_38 != 0)) {
auStack_56[iStack_38] = 0;
iStack_14 = func_0x00400dc0(auStack_56);
}
}
if (iStack_34 != -1) {
func_0x00400d20(iStack_34);
}
}
for (iStack_10 = 0; iStack_10 < 1; iStack_10 = iStack_10 + 1) {
uStack_20 = 0;
lStack_28 = 0;
puStack_30 = &UNK_00401642;
lStack_28 = func_0x00400db0(&UNK_00401642,&UNK_00401651);
if (lStack_28 == 0) {
func_0x00400dd0(1);
}
for (uStack_20 = 0; uStack_20 < (ulong)(long)iStack_14; uStack_20 = uStack_20 + 1) {
lVar2 = func_0x00400df0(&UNK_00401658,1,0x32,lStack_28);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lStack_28 != 0) {
func_0x00400ce0(lStack_28);
}
}
return;
}
|
['gcc']
|
53,910
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_17_good()
{
goodB2G();
goodG2B();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98545/CWE400_Resource_Exhaustion__connect_socket_fwrite_17.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_17_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_17_good(void)
{
goodB2G();
goodG2B();
return;
}
|
['gcc']
|
53,911
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_18_bad()
{
int count;
/* Initialize count */
count = -1;
goto source;
source:
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
goto sink;
sink:
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
|
['/* Initialize count */', '/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */', '/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98546/CWE400_Resource_Exhaustion__connect_socket_fwrite_18.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_18_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_18_bad(void)
{
int iVar1;
long lVar2;
undefined auStack_56 [14];
undefined2 uStack_48;
undefined2 uStack_46;
undefined4 uStack_44;
undefined *puStack_30;
long lStack_28;
int iStack_20;
int iStack_1c;
ulong uStack_18;
int iStack_c;
iStack_c = -1;
iStack_1c = 0xffffffff;
iStack_1c = func_0x00400e20(2,1,6);
if (iStack_1c != -1) {
func_0x00400d10(&uStack_48,0,0x10);
uStack_48 = 2;
uStack_44 = func_0x00400d60(&UNK_004015f8);
uStack_46 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_1c,&uStack_48,0x10);
if (((iVar1 != -1) && (iStack_20 = func_0x00400cb0(iStack_1c,auStack_56,0xd,0), iStack_20 != -1)
) && (iStack_20 != 0)) {
auStack_56[iStack_20] = 0;
iStack_c = func_0x00400dc0(auStack_56);
}
}
if (iStack_1c != -1) {
func_0x00400d20(iStack_1c);
}
uStack_18 = 0;
lStack_28 = 0;
puStack_30 = &UNK_00401602;
lStack_28 = func_0x00400db0(&UNK_00401602,&UNK_00401611);
if (lStack_28 == 0) {
func_0x00400dd0(1);
}
for (uStack_18 = 0; uStack_18 < (ulong)(long)iStack_c; uStack_18 = uStack_18 + 1) {
lVar2 = func_0x00400df0(&UNK_00401618,1,0x32,lStack_28);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lStack_28 != 0) {
func_0x00400ce0(lStack_28);
}
return;
}
|
['gcc']
|
53,912
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_18_good()
{
goodB2G();
goodG2B();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98546/CWE400_Resource_Exhaustion__connect_socket_fwrite_18.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_18_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_18_good(void)
{
goodB2G();
goodG2B();
return;
}
|
['gcc']
|
53,913
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_21_bad()
{
int count;
/* Initialize count */
count = -1;
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
badStatic = 1; /* true */
badSink(count);
}
|
['/* Initialize count */', '/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */', '/* true */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98547/CWE400_Resource_Exhaustion__connect_socket_fwrite_21.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_21_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_21_bad(void)
{
int iVar1;
undefined auStack_36 [14];
undefined2 uStack_28;
undefined2 uStack_26;
undefined4 uStack_24;
int iStack_14;
int iStack_10;
undefined4 uStack_c;
uStack_c = 0xffffffff;
iStack_10 = 0xffffffff;
iStack_10 = func_0x00400e20(2,1,6);
if (iStack_10 != -1) {
func_0x00400d10(&uStack_28,0,0x10);
uStack_28 = 2;
uStack_24 = func_0x00400d60(&UNK_00401673);
uStack_26 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_10,&uStack_28,0x10);
if (((iVar1 != -1) && (iStack_14 = func_0x00400cb0(iStack_10,auStack_36,0xd,0), iStack_14 != -1)
) && (iStack_14 != 0)) {
auStack_36[iStack_14] = 0;
uStack_c = func_0x00400dc0(auStack_36);
}
}
if (iStack_10 != -1) {
func_0x00400d20(iStack_10);
}
badStatic = 1;
badSink(uStack_c);
return;
}
|
['gcc']
|
53,914
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_21_good()
{
goodB2G1();
goodB2G2();
goodG2B();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98547/CWE400_Resource_Exhaustion__connect_socket_fwrite_21.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_21_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_21_good(void)
{
goodB2G1();
goodB2G2();
goodG2B();
return;
}
|
['gcc']
|
53,915
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_22_bad()
{
int count;
/* Initialize count */
count = -1;
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
CWE400_Resource_Exhaustion__connect_socket_fwrite_22_badGlobal = 1; /* true */
CWE400_Resource_Exhaustion__connect_socket_fwrite_22_badSink(count);
}
|
['/* Initialize count */', '/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */', '/* true */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98548/CWE400_Resource_Exhaustion__connect_socket_fwrite_22a.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_22_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_22_bad(void)
{
int iVar1;
undefined auStack_36 [14];
undefined2 uStack_28;
undefined2 uStack_26;
undefined4 uStack_24;
int iStack_14;
int iStack_10;
undefined4 uStack_c;
uStack_c = 0xffffffff;
iStack_10 = 0xffffffff;
iStack_10 = func_0x00400e20(2,1,6);
if (iStack_10 != -1) {
func_0x00400d10(&uStack_28,0,0x10);
uStack_28 = 2;
uStack_24 = func_0x00400d60(&UNK_00401624);
uStack_26 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_10,&uStack_28,0x10);
if (((iVar1 != -1) && (iStack_14 = func_0x00400cb0(iStack_10,auStack_36,0xd,0), iStack_14 != -1)
) && (iStack_14 != 0)) {
auStack_36[iStack_14] = 0;
uStack_c = func_0x00400dc0(auStack_36);
}
}
if (iStack_10 != -1) {
func_0x00400d20(iStack_10);
}
CWE400_Resource_Exhaustion__connect_socket_fwrite_22_badGlobal = 1;
CWE400_Resource_Exhaustion__connect_socket_fwrite_22_badSink(uStack_c);
return;
}
|
['gcc']
|
53,916
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_22_good()
{
goodB2G1();
goodB2G2();
goodG2B();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98548/CWE400_Resource_Exhaustion__connect_socket_fwrite_22a.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_22_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_22_good(void)
{
goodB2G1();
goodB2G2();
goodG2B();
return;
}
|
['gcc']
|
53,917
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_22_badSink(int count)
{
if(CWE400_Resource_Exhaustion__connect_socket_fwrite_22_badGlobal)
{
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
}
|
['/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98548/CWE400_Resource_Exhaustion__connect_socket_fwrite_22b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_22_badSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_22_badSink(int param_1)
{
long lVar1;
long lVar2;
ulong uStack_10;
if (CWE400_Resource_Exhaustion__connect_socket_fwrite_22_badGlobal != 0) {
lVar1 = func_0x00400db0(&UNK_00401628,&UNK_00401637);
if (lVar1 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)param_1; uStack_10 = uStack_10 + 1) {
lVar2 = func_0x00400df0(&UNK_00401640,1,0x32,lVar1);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar1 != 0) {
func_0x00400ce0(lVar1);
}
}
return;
}
|
['gcc']
|
53,918
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_22_goodB2G1Sink(int count)
{
if(CWE400_Resource_Exhaustion__connect_socket_fwrite_22_goodB2G1Global)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_good.txt";
/* FIX: Validate count before using it as the for loop variant to write to a file */
if (count > 0 && count <= 20)
{
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile)) exit(1);
}
if (pFile)
{
fclose(pFile);
}
}
}
}
}
|
['/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */', '/* FIX: Validate count before using it as the for loop variant to write to a file */']
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98548/CWE400_Resource_Exhaustion__connect_socket_fwrite_22b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_22_goodB2G1Sink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_22_goodB2G1Sink(int param_1)
{
long lVar1;
long lVar2;
ulong uStack_10;
if (CWE400_Resource_Exhaustion__connect_socket_fwrite_22_goodB2G1Global == 0) {
if ((0 < param_1) && (param_1 < 0x15)) {
lVar1 = func_0x00400db0(&UNK_0040191d,&UNK_0040192d);
if (lVar1 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)param_1; uStack_10 = uStack_10 + 1) {
lVar2 = func_0x00400df0(&UNK_00401930,1,0x32,lVar1);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar1 != 0) {
func_0x00400ce0(lVar1);
}
}
}
else {
printLine(&UNK_00401908);
}
return;
}
|
['gcc']
|
53,919
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_22_goodB2G2Sink(int count)
{
if(CWE400_Resource_Exhaustion__connect_socket_fwrite_22_goodB2G2Global)
{
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_good.txt";
/* FIX: Validate count before using it as the for loop variant to write to a file */
if (count > 0 && count <= 20)
{
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile)) exit(1);
}
if (pFile)
{
fclose(pFile);
}
}
}
}
}
|
['/* FIX: Validate count before using it as the for loop variant to write to a file */']
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98548/CWE400_Resource_Exhaustion__connect_socket_fwrite_22b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_22_goodB2G2Sink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_22_goodB2G2Sink(int param_1)
{
long lVar1;
long lVar2;
ulong uStack_10;
if (CWE400_Resource_Exhaustion__connect_socket_fwrite_22_goodB2G2Global != 0) {
if ((0 < param_1) && (param_1 < 0x15)) {
lVar1 = func_0x00400db0(&UNK_0040191d,&UNK_0040192d);
if (lVar1 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)param_1; uStack_10 = uStack_10 + 1) {
lVar2 = func_0x00400df0(&UNK_00401930,1,0x32,lVar1);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar1 != 0) {
func_0x00400ce0(lVar1);
}
}
}
return;
}
|
['gcc']
|
53,920
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_22_goodG2BSink(int count)
{
if(CWE400_Resource_Exhaustion__connect_socket_fwrite_22_goodG2BGlobal)
{
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
}
|
['/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98548/CWE400_Resource_Exhaustion__connect_socket_fwrite_22b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_22_goodG2BSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_22_goodG2BSink(int param_1)
{
long lVar1;
long lVar2;
ulong uStack_10;
if (CWE400_Resource_Exhaustion__connect_socket_fwrite_22_goodG2BGlobal != 0) {
lVar1 = func_0x00400db0(&UNK_00401963,&UNK_0040192d);
if (lVar1 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)param_1; uStack_10 = uStack_10 + 1) {
lVar2 = func_0x00400df0(&UNK_00401930,1,0x32,lVar1);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar1 != 0) {
func_0x00400ce0(lVar1);
}
}
return;
}
|
['gcc']
|
53,921
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_31_bad()
{
int count;
/* Initialize count */
count = -1;
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
{
int countCopy = count;
int count = countCopy;
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
}
|
['/* Initialize count */', '/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */', '/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98549/CWE400_Resource_Exhaustion__connect_socket_fwrite_31.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_31_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_31_bad(void)
{
int iVar1;
long lVar2;
undefined auStack_56 [14];
undefined2 uStack_48;
undefined2 uStack_46;
undefined4 uStack_44;
undefined *puStack_38;
long lStack_30;
int iStack_28;
int iStack_24;
int iStack_20;
int iStack_1c;
ulong uStack_18;
int iStack_c;
iStack_c = -1;
iStack_1c = 0xffffffff;
iStack_1c = func_0x00400e20(2,1,6);
if (iStack_1c != -1) {
func_0x00400d10(&uStack_48,0,0x10);
uStack_48 = 2;
uStack_44 = func_0x00400d60(&UNK_00401608);
uStack_46 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_1c,&uStack_48,0x10);
if (((iVar1 != -1) && (iStack_20 = func_0x00400cb0(iStack_1c,auStack_56,0xd,0), iStack_20 != -1)
) && (iStack_20 != 0)) {
auStack_56[iStack_20] = 0;
iStack_c = func_0x00400dc0(auStack_56);
}
}
if (iStack_1c != -1) {
func_0x00400d20(iStack_1c);
}
iStack_24 = iStack_c;
iStack_28 = iStack_c;
uStack_18 = 0;
lStack_30 = 0;
puStack_38 = &UNK_00401612;
lStack_30 = func_0x00400db0(&UNK_00401612,&UNK_00401621);
if (lStack_30 == 0) {
func_0x00400dd0(1);
}
for (uStack_18 = 0; uStack_18 < (ulong)(long)iStack_28; uStack_18 = uStack_18 + 1) {
lVar2 = func_0x00400df0(&UNK_00401628,1,0x32,lStack_30);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lStack_30 != 0) {
func_0x00400ce0(lStack_30);
}
return;
}
|
['gcc']
|
53,922
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_31_good()
{
goodG2B();
goodB2G();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98549/CWE400_Resource_Exhaustion__connect_socket_fwrite_31.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_31_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_31_good(void)
{
goodG2B();
goodB2G();
return;
}
|
['gcc']
|
53,923
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_32_bad()
{
int count;
int *countPtr1 = &count;
int *countPtr2 = &count;
/* Initialize count */
count = -1;
{
int count = *countPtr1;
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
*countPtr1 = count;
}
{
int count = *countPtr2;
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
}
|
['/* Initialize count */', '/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */', '/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98550/CWE400_Resource_Exhaustion__connect_socket_fwrite_32.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_32_bad
|
/* WARNING: Restarted to delay deadcode elimination for space: stack */
void CWE400_Resource_Exhaustion__connect_socket_fwrite_32_bad(void)
{
int iVar1;
long lVar2;
undefined auStack_76 [14];
undefined2 uStack_68;
undefined2 uStack_66;
undefined4 uStack_64;
int iStack_4c;
undefined *puStack_48;
long lStack_40;
int iStack_34;
int iStack_30;
int iStack_2c;
int *piStack_28;
int *piStack_20;
ulong uStack_18;
int iStack_c;
piStack_20 = &iStack_4c;
piStack_28 = &iStack_4c;
iStack_4c = -1;
iStack_c = -1;
iStack_2c = 0xffffffff;
iStack_2c = func_0x00400e20(2,1,6);
if (iStack_2c != -1) {
func_0x00400d10(&uStack_68,0,0x10);
uStack_68 = 2;
uStack_64 = func_0x00400d60(&UNK_00401628);
uStack_66 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_2c,&uStack_68,0x10);
if (((iVar1 != -1) && (iStack_30 = func_0x00400cb0(iStack_2c,auStack_76,0xd,0), iStack_30 != -1)
) && (iStack_30 != 0)) {
auStack_76[iStack_30] = 0;
iStack_c = func_0x00400dc0(auStack_76);
}
}
if (iStack_2c != -1) {
func_0x00400d20(iStack_2c);
}
*piStack_20 = iStack_c;
iStack_34 = *piStack_28;
uStack_18 = 0;
lStack_40 = 0;
puStack_48 = &UNK_00401632;
lStack_40 = func_0x00400db0(&UNK_00401632,&UNK_00401641);
if (lStack_40 == 0) {
func_0x00400dd0(1);
}
for (uStack_18 = 0; uStack_18 < (ulong)(long)iStack_34; uStack_18 = uStack_18 + 1) {
lVar2 = func_0x00400df0(&UNK_00401648,1,0x32,lStack_40);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lStack_40 != 0) {
func_0x00400ce0(lStack_40);
}
return;
}
|
['gcc']
|
53,924
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_32_good()
{
goodG2B();
goodB2G();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98550/CWE400_Resource_Exhaustion__connect_socket_fwrite_32.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_32_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_32_good(void)
{
goodG2B();
goodB2G();
return;
}
|
['gcc']
|
53,925
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_34_bad()
{
int count;
CWE400_Resource_Exhaustion__connect_socket_fwrite_34_unionType myUnion;
/* Initialize count */
count = -1;
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
myUnion.unionFirst = count;
{
int count = myUnion.unionSecond;
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
}
|
['/* Initialize count */', '/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */', '/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98552/CWE400_Resource_Exhaustion__connect_socket_fwrite_34.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_34_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_34_bad(void)
{
int iVar1;
long lVar2;
undefined auStack_66 [14];
undefined2 uStack_58;
undefined2 uStack_56;
undefined4 uStack_54;
int iStack_3c;
undefined *puStack_38;
long lStack_30;
int iStack_24;
int iStack_20;
int iStack_1c;
ulong uStack_18;
int iStack_c;
iStack_c = -1;
iStack_1c = 0xffffffff;
iStack_1c = func_0x00400e20(2,1,6);
if (iStack_1c != -1) {
func_0x00400d10(&uStack_58,0,0x10);
uStack_58 = 2;
uStack_54 = func_0x00400d60(&UNK_00401608);
uStack_56 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_1c,&uStack_58,0x10);
if (((iVar1 != -1) && (iStack_20 = func_0x00400cb0(iStack_1c,auStack_66,0xd,0), iStack_20 != -1)
) && (iStack_20 != 0)) {
auStack_66[iStack_20] = 0;
iStack_c = func_0x00400dc0(auStack_66);
}
}
if (iStack_1c != -1) {
func_0x00400d20(iStack_1c);
}
iStack_3c = iStack_c;
iStack_24 = iStack_c;
uStack_18 = 0;
lStack_30 = 0;
puStack_38 = &UNK_00401612;
lStack_30 = func_0x00400db0(&UNK_00401612,&UNK_00401621);
if (lStack_30 == 0) {
func_0x00400dd0(1);
}
for (uStack_18 = 0; uStack_18 < (ulong)(long)iStack_24; uStack_18 = uStack_18 + 1) {
lVar2 = func_0x00400df0(&UNK_00401628,1,0x32,lStack_30);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lStack_30 != 0) {
func_0x00400ce0(lStack_30);
}
return;
}
|
['gcc']
|
53,926
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_34_good()
{
goodG2B();
goodB2G();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98552/CWE400_Resource_Exhaustion__connect_socket_fwrite_34.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_34_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_34_good(void)
{
goodG2B();
goodB2G();
return;
}
|
['gcc']
|
53,927
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_41_bad()
{
int count;
/* Initialize count */
count = -1;
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
badSink(count);
}
|
['/* Initialize count */', '/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98553/CWE400_Resource_Exhaustion__connect_socket_fwrite_41.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_41_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_41_bad(void)
{
int iVar1;
undefined auStack_36 [14];
undefined2 uStack_28;
undefined2 uStack_26;
undefined4 uStack_24;
int iStack_14;
int iStack_10;
undefined4 uStack_c;
uStack_c = 0xffffffff;
iStack_10 = 0xffffffff;
iStack_10 = func_0x00400e20(2,1,6);
if (iStack_10 != -1) {
func_0x00400d10(&uStack_28,0,0x10);
uStack_28 = 2;
uStack_24 = func_0x00400d60(&UNK_00401663);
uStack_26 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_10,&uStack_28,0x10);
if (((iVar1 != -1) && (iStack_14 = func_0x00400cb0(iStack_10,auStack_36,0xd,0), iStack_14 != -1)
) && (iStack_14 != 0)) {
auStack_36[iStack_14] = 0;
uStack_c = func_0x00400dc0(auStack_36);
}
}
if (iStack_10 != -1) {
func_0x00400d20(iStack_10);
}
badSink(uStack_c);
return;
}
|
['gcc']
|
53,928
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_41_good()
{
goodB2G();
goodG2B();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98553/CWE400_Resource_Exhaustion__connect_socket_fwrite_41.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_41_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_41_good(void)
{
goodB2G();
goodG2B();
return;
}
|
['gcc']
|
53,929
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_42_bad()
{
int count;
/* Initialize count */
count = -1;
count = badSource(count);
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
|
['/* Initialize count */', '/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98554/CWE400_Resource_Exhaustion__connect_socket_fwrite_42.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_42_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_42_bad(void)
{
int iVar1;
long lVar2;
long lVar3;
ulong uStack_10;
iVar1 = badSource(0xffffffff);
lVar2 = func_0x00400db0(&UNK_00401622,&UNK_00401631);
if (lVar2 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)iVar1; uStack_10 = uStack_10 + 1) {
lVar3 = func_0x00400df0(&UNK_00401638,1,0x32,lVar2);
if (lVar3 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar2 != 0) {
func_0x00400ce0(lVar2);
}
return;
}
|
['gcc']
|
53,930
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_42_good()
{
goodB2G();
goodG2B();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98554/CWE400_Resource_Exhaustion__connect_socket_fwrite_42.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_42_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_42_good(void)
{
goodB2G();
goodG2B();
return;
}
|
['gcc']
|
53,931
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_44_bad()
{
int count;
/* define a function pointer */
void (*funcPtr) (int) = badSink;
/* Initialize count */
count = -1;
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
/* use the function pointer */
funcPtr(count);
}
|
['/* define a function pointer */', '/* Initialize count */', '/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */', '/* use the function pointer */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98556/CWE400_Resource_Exhaustion__connect_socket_fwrite_44.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_44_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_44_bad(void)
{
int iVar1;
undefined auStack_46 [14];
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
int iStack_20;
int iStack_1c;
code *pcStack_18;
undefined4 uStack_c;
pcStack_18 = badSink;
uStack_c = 0xffffffff;
iStack_1c = 0xffffffff;
iStack_1c = func_0x00400e20(2,1,6);
if (iStack_1c != -1) {
func_0x00400d10(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = func_0x00400d60(&UNK_00401663);
uStack_36 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_1c,&uStack_38,0x10);
if (((iVar1 != -1) && (iStack_20 = func_0x00400cb0(iStack_1c,auStack_46,0xd,0), iStack_20 != -1)
) && (iStack_20 != 0)) {
auStack_46[iStack_20] = 0;
uStack_c = func_0x00400dc0(auStack_46);
}
}
if (iStack_1c != -1) {
func_0x00400d20(iStack_1c);
}
(*pcStack_18)(uStack_c);
return;
}
|
['gcc']
|
53,932
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_44_good()
{
goodG2B();
goodB2G();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98556/CWE400_Resource_Exhaustion__connect_socket_fwrite_44.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_44_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_44_good(void)
{
goodG2B();
goodB2G();
return;
}
|
['gcc']
|
53,933
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_45_bad()
{
int count;
/* Initialize count */
count = -1;
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
CWE400_Resource_Exhaustion__connect_socket_fwrite_45_badData = count;
badSink();
}
|
['/* Initialize count */', '/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98557/CWE400_Resource_Exhaustion__connect_socket_fwrite_45.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_45_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_45_bad(void)
{
int iVar1;
undefined auStack_36 [14];
undefined2 uStack_28;
undefined2 uStack_26;
undefined4 uStack_24;
int iStack_14;
int iStack_10;
undefined4 uStack_c;
uStack_c = 0xffffffff;
iStack_10 = 0xffffffff;
iStack_10 = func_0x00400e20(2,1,6);
if (iStack_10 != -1) {
func_0x00400d10(&uStack_28,0,0x10);
uStack_28 = 2;
uStack_24 = func_0x00400d60(&UNK_00401673);
uStack_26 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_10,&uStack_28,0x10);
if (((iVar1 != -1) && (iStack_14 = func_0x00400cb0(iStack_10,auStack_36,0xd,0), iStack_14 != -1)
) && (iStack_14 != 0)) {
auStack_36[iStack_14] = 0;
uStack_c = func_0x00400dc0(auStack_36);
}
}
if (iStack_10 != -1) {
func_0x00400d20(iStack_10);
}
CWE400_Resource_Exhaustion__connect_socket_fwrite_45_badData = uStack_c;
badSink();
return;
}
|
['gcc']
|
53,934
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_45_good()
{
goodG2B();
goodB2G();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98557/CWE400_Resource_Exhaustion__connect_socket_fwrite_45.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_45_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_45_good(void)
{
goodG2B();
goodB2G();
return;
}
|
['gcc']
|
53,935
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_51_bad()
{
int count;
/* Initialize count */
count = -1;
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
CWE400_Resource_Exhaustion__connect_socket_fwrite_51b_badSink(count);
}
|
['/* Initialize count */', '/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98558/CWE400_Resource_Exhaustion__connect_socket_fwrite_51a.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_51_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_51_bad(void)
{
int iVar1;
undefined auStack_36 [14];
undefined2 uStack_28;
undefined2 uStack_26;
undefined4 uStack_24;
int iStack_14;
int iStack_10;
undefined4 uStack_c;
uStack_c = 0xffffffff;
iStack_10 = 0xffffffff;
iStack_10 = func_0x00400e20(2,1,6);
if (iStack_10 != -1) {
func_0x00400d10(&uStack_28,0,0x10);
uStack_28 = 2;
uStack_24 = func_0x00400d60(&UNK_00401614);
uStack_26 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_10,&uStack_28,0x10);
if (((iVar1 != -1) && (iStack_14 = func_0x00400cb0(iStack_10,auStack_36,0xd,0), iStack_14 != -1)
) && (iStack_14 != 0)) {
auStack_36[iStack_14] = 0;
uStack_c = func_0x00400dc0(auStack_36);
}
}
if (iStack_10 != -1) {
func_0x00400d20(iStack_10);
}
CWE400_Resource_Exhaustion__connect_socket_fwrite_51b_badSink(uStack_c);
return;
}
|
['gcc']
|
53,936
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_51_good()
{
goodG2B();
goodB2G();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98558/CWE400_Resource_Exhaustion__connect_socket_fwrite_51a.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_51_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_51_good(void)
{
goodG2B();
goodB2G();
return;
}
|
['gcc']
|
53,937
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_51b_badSink(int count)
{
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
|
['/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98558/CWE400_Resource_Exhaustion__connect_socket_fwrite_51b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_51b_badSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_51b_badSink(int param_1)
{
long lVar1;
long lVar2;
ulong uStack_10;
lVar1 = func_0x00400db0(&UNK_00401618,&UNK_00401627);
if (lVar1 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)param_1; uStack_10 = uStack_10 + 1) {
lVar2 = func_0x00400df0(&UNK_00401630,1,0x32,lVar1);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar1 != 0) {
func_0x00400ce0(lVar1);
}
return;
}
|
['gcc']
|
53,938
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_51b_goodG2BSink(int count)
{
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
|
['/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98558/CWE400_Resource_Exhaustion__connect_socket_fwrite_51b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_51b_goodG2BSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_51b_goodG2BSink(int param_1)
{
long lVar1;
long lVar2;
ulong uStack_10;
lVar1 = func_0x00400db0(&UNK_00401708,&UNK_00401717);
if (lVar1 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)param_1; uStack_10 = uStack_10 + 1) {
lVar2 = func_0x00400df0(&UNK_00401720,1,0x32,lVar1);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar1 != 0) {
func_0x00400ce0(lVar1);
}
return;
}
|
['gcc']
|
53,939
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_51b_goodB2GSink(int count)
{
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_good.txt";
/* FIX: Validate count before using it as the for loop variant to write to a file */
if (count > 0 && count <= 20)
{
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile)) exit(1);
}
if (pFile)
{
fclose(pFile);
}
}
}
}
|
['/* FIX: Validate count before using it as the for loop variant to write to a file */']
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98558/CWE400_Resource_Exhaustion__connect_socket_fwrite_51b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_51b_goodB2GSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_51b_goodB2GSink(int param_1)
{
long lVar1;
long lVar2;
ulong uStack_10;
if ((0 < param_1) && (param_1 < 0x15)) {
lVar1 = func_0x00400db0(&UNK_00401753,&UNK_00401717);
if (lVar1 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)param_1; uStack_10 = uStack_10 + 1) {
lVar2 = func_0x00400df0(&UNK_00401720,1,0x32,lVar1);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar1 != 0) {
func_0x00400ce0(lVar1);
}
}
return;
}
|
['gcc']
|
53,940
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_52_bad()
{
int count;
/* Initialize count */
count = -1;
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
CWE400_Resource_Exhaustion__connect_socket_fwrite_52b_badSink(count);
}
|
['/* Initialize count */', '/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98559/CWE400_Resource_Exhaustion__connect_socket_fwrite_52a.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_52_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_52_bad(void)
{
int iVar1;
undefined auStack_36 [14];
undefined2 uStack_28;
undefined2 uStack_26;
undefined4 uStack_24;
int iStack_14;
int iStack_10;
undefined4 uStack_c;
uStack_c = 0xffffffff;
iStack_10 = 0xffffffff;
iStack_10 = func_0x00400e20(2,1,6);
if (iStack_10 != -1) {
func_0x00400d10(&uStack_28,0,0x10);
uStack_28 = 2;
uStack_24 = func_0x00400d60(&UNK_00401624);
uStack_26 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_10,&uStack_28,0x10);
if (((iVar1 != -1) && (iStack_14 = func_0x00400cb0(iStack_10,auStack_36,0xd,0), iStack_14 != -1)
) && (iStack_14 != 0)) {
auStack_36[iStack_14] = 0;
uStack_c = func_0x00400dc0(auStack_36);
}
}
if (iStack_10 != -1) {
func_0x00400d20(iStack_10);
}
CWE400_Resource_Exhaustion__connect_socket_fwrite_52b_badSink(uStack_c);
return;
}
|
['gcc']
|
53,941
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_52_good()
{
goodG2B();
goodB2G();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98559/CWE400_Resource_Exhaustion__connect_socket_fwrite_52a.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_52_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_52_good(void)
{
goodG2B();
goodB2G();
return;
}
|
['gcc']
|
53,942
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_52b_badSink(int count)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_52c_badSink(count);
}
|
[]
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98559/CWE400_Resource_Exhaustion__connect_socket_fwrite_52b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_52b_badSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_52b_badSink(undefined4 param_1)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_52c_badSink(param_1);
return;
}
|
['gcc']
|
53,943
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_52b_goodG2BSink(int count)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_52c_goodG2BSink(count);
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98559/CWE400_Resource_Exhaustion__connect_socket_fwrite_52b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_52b_goodG2BSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_52b_goodG2BSink(undefined4 param_1)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_52c_goodG2BSink(param_1);
return;
}
|
['gcc']
|
53,944
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_52b_goodB2GSink(int count)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_52c_goodB2GSink(count);
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98559/CWE400_Resource_Exhaustion__connect_socket_fwrite_52b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_52b_goodB2GSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_52b_goodB2GSink(undefined4 param_1)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_52c_goodB2GSink(param_1);
return;
}
|
['gcc']
|
53,945
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_52c_badSink(int count)
{
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
|
['/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98559/CWE400_Resource_Exhaustion__connect_socket_fwrite_52c.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_52c_badSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_52c_badSink(int param_1)
{
long lVar1;
long lVar2;
ulong uStack_10;
lVar1 = func_0x00400db0(&UNK_00401628,&UNK_00401637);
if (lVar1 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)param_1; uStack_10 = uStack_10 + 1) {
lVar2 = func_0x00400df0(&UNK_00401640,1,0x32,lVar1);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar1 != 0) {
func_0x00400ce0(lVar1);
}
return;
}
|
['gcc']
|
53,946
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_52c_goodG2BSink(int count)
{
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
|
['/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98559/CWE400_Resource_Exhaustion__connect_socket_fwrite_52c.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_52c_goodG2BSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_52c_goodG2BSink(int param_1)
{
long lVar1;
long lVar2;
ulong uStack_10;
lVar1 = func_0x00400db0(&UNK_00401738,&UNK_00401747);
if (lVar1 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)param_1; uStack_10 = uStack_10 + 1) {
lVar2 = func_0x00400df0(&UNK_00401750,1,0x32,lVar1);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar1 != 0) {
func_0x00400ce0(lVar1);
}
return;
}
|
['gcc']
|
53,947
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_52c_goodB2GSink(int count)
{
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_good.txt";
/* FIX: Validate count before using it as the for loop variant to write to a file */
if (count > 0 && count <= 20)
{
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile)) exit(1);
}
if (pFile)
{
fclose(pFile);
}
}
}
}
|
['/* FIX: Validate count before using it as the for loop variant to write to a file */']
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98559/CWE400_Resource_Exhaustion__connect_socket_fwrite_52c.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_52c_goodB2GSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_52c_goodB2GSink(int param_1)
{
long lVar1;
long lVar2;
ulong uStack_10;
if ((0 < param_1) && (param_1 < 0x15)) {
lVar1 = func_0x00400db0(&UNK_00401783,&UNK_00401747);
if (lVar1 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)param_1; uStack_10 = uStack_10 + 1) {
lVar2 = func_0x00400df0(&UNK_00401750,1,0x32,lVar1);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar1 != 0) {
func_0x00400ce0(lVar1);
}
}
return;
}
|
['gcc']
|
53,948
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_53_bad()
{
int count;
/* Initialize count */
count = -1;
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
CWE400_Resource_Exhaustion__connect_socket_fwrite_53b_badSink(count);
}
|
['/* Initialize count */', '/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98560/CWE400_Resource_Exhaustion__connect_socket_fwrite_53a.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_53_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_53_bad(void)
{
int iVar1;
undefined auStack_36 [14];
undefined2 uStack_28;
undefined2 uStack_26;
undefined4 uStack_24;
int iStack_14;
int iStack_10;
undefined4 uStack_c;
uStack_c = 0xffffffff;
iStack_10 = 0xffffffff;
iStack_10 = func_0x00400e20(2,1,6);
if (iStack_10 != -1) {
func_0x00400d10(&uStack_28,0,0x10);
uStack_28 = 2;
uStack_24 = func_0x00400d60(&UNK_00401644);
uStack_26 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_10,&uStack_28,0x10);
if (((iVar1 != -1) && (iStack_14 = func_0x00400cb0(iStack_10,auStack_36,0xd,0), iStack_14 != -1)
) && (iStack_14 != 0)) {
auStack_36[iStack_14] = 0;
uStack_c = func_0x00400dc0(auStack_36);
}
}
if (iStack_10 != -1) {
func_0x00400d20(iStack_10);
}
CWE400_Resource_Exhaustion__connect_socket_fwrite_53b_badSink(uStack_c);
return;
}
|
['gcc']
|
53,949
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_53_good()
{
goodG2B();
goodB2G();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98560/CWE400_Resource_Exhaustion__connect_socket_fwrite_53a.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_53_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_53_good(void)
{
goodG2B();
goodB2G();
return;
}
|
['gcc']
|
53,950
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_53b_badSink(int count)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_53c_badSink(count);
}
|
[]
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98560/CWE400_Resource_Exhaustion__connect_socket_fwrite_53b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_53b_badSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_53b_badSink(undefined4 param_1)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_53c_badSink(param_1);
return;
}
|
['gcc']
|
53,951
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_53b_goodG2BSink(int count)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_53c_goodG2BSink(count);
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98560/CWE400_Resource_Exhaustion__connect_socket_fwrite_53b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_53b_goodG2BSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_53b_goodG2BSink(undefined4 param_1)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_53c_goodG2BSink(param_1);
return;
}
|
['gcc']
|
53,952
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_53b_goodB2GSink(int count)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_53c_goodB2GSink(count);
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98560/CWE400_Resource_Exhaustion__connect_socket_fwrite_53b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_53b_goodB2GSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_53b_goodB2GSink(undefined4 param_1)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_53c_goodB2GSink(param_1);
return;
}
|
['gcc']
|
53,953
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_53c_badSink(int count)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_53d_badSink(count);
}
|
[]
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98560/CWE400_Resource_Exhaustion__connect_socket_fwrite_53c.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_53c_badSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_53c_badSink(undefined4 param_1)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_53d_badSink(param_1);
return;
}
|
['gcc']
|
53,954
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_53c_goodG2BSink(int count)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_53d_goodG2BSink(count);
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98560/CWE400_Resource_Exhaustion__connect_socket_fwrite_53c.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_53c_goodG2BSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_53c_goodG2BSink(undefined4 param_1)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_53d_goodG2BSink(param_1);
return;
}
|
['gcc']
|
53,955
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_53c_goodB2GSink(int count)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_53d_goodB2GSink(count);
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98560/CWE400_Resource_Exhaustion__connect_socket_fwrite_53c.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_53c_goodB2GSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_53c_goodB2GSink(undefined4 param_1)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_53d_goodB2GSink(param_1);
return;
}
|
['gcc']
|
53,956
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_53d_badSink(int count)
{
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
|
['/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98560/CWE400_Resource_Exhaustion__connect_socket_fwrite_53d.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_53d_badSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_53d_badSink(int param_1)
{
long lVar1;
long lVar2;
ulong uStack_10;
lVar1 = func_0x00400db0(&UNK_00401648,&UNK_00401657);
if (lVar1 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)param_1; uStack_10 = uStack_10 + 1) {
lVar2 = func_0x00400df0(&UNK_00401660,1,0x32,lVar1);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar1 != 0) {
func_0x00400ce0(lVar1);
}
return;
}
|
['gcc']
|
53,957
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_53d_goodG2BSink(int count)
{
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
|
['/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98560/CWE400_Resource_Exhaustion__connect_socket_fwrite_53d.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_53d_goodG2BSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_53d_goodG2BSink(int param_1)
{
long lVar1;
long lVar2;
ulong uStack_10;
lVar1 = func_0x00400db0(&UNK_00401768,&UNK_00401777);
if (lVar1 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)param_1; uStack_10 = uStack_10 + 1) {
lVar2 = func_0x00400df0(&UNK_00401780,1,0x32,lVar1);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar1 != 0) {
func_0x00400ce0(lVar1);
}
return;
}
|
['gcc']
|
53,958
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_53d_goodB2GSink(int count)
{
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_good.txt";
/* FIX: Validate count before using it as the for loop variant to write to a file */
if (count > 0 && count <= 20)
{
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile)) exit(1);
}
if (pFile)
{
fclose(pFile);
}
}
}
}
|
['/* FIX: Validate count before using it as the for loop variant to write to a file */']
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98560/CWE400_Resource_Exhaustion__connect_socket_fwrite_53d.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_53d_goodB2GSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_53d_goodB2GSink(int param_1)
{
long lVar1;
long lVar2;
ulong uStack_10;
if ((0 < param_1) && (param_1 < 0x15)) {
lVar1 = func_0x00400db0(&UNK_004017b3,&UNK_00401777);
if (lVar1 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)param_1; uStack_10 = uStack_10 + 1) {
lVar2 = func_0x00400df0(&UNK_00401780,1,0x32,lVar1);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar1 != 0) {
func_0x00400ce0(lVar1);
}
}
return;
}
|
['gcc']
|
53,959
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54_bad()
{
int count;
/* Initialize count */
count = -1;
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
CWE400_Resource_Exhaustion__connect_socket_fwrite_54b_badSink(count);
}
|
['/* Initialize count */', '/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98561/CWE400_Resource_Exhaustion__connect_socket_fwrite_54a.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_54_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54_bad(void)
{
int iVar1;
undefined auStack_36 [14];
undefined2 uStack_28;
undefined2 uStack_26;
undefined4 uStack_24;
int iStack_14;
int iStack_10;
undefined4 uStack_c;
uStack_c = 0xffffffff;
iStack_10 = 0xffffffff;
iStack_10 = func_0x00400e20(2,1,6);
if (iStack_10 != -1) {
func_0x00400d10(&uStack_28,0,0x10);
uStack_28 = 2;
uStack_24 = func_0x00400d60(&UNK_00401654);
uStack_26 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_10,&uStack_28,0x10);
if (((iVar1 != -1) && (iStack_14 = func_0x00400cb0(iStack_10,auStack_36,0xd,0), iStack_14 != -1)
) && (iStack_14 != 0)) {
auStack_36[iStack_14] = 0;
uStack_c = func_0x00400dc0(auStack_36);
}
}
if (iStack_10 != -1) {
func_0x00400d20(iStack_10);
}
CWE400_Resource_Exhaustion__connect_socket_fwrite_54b_badSink(uStack_c);
return;
}
|
['gcc']
|
53,960
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54_good()
{
goodG2B();
goodB2G();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98561/CWE400_Resource_Exhaustion__connect_socket_fwrite_54a.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_54_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54_good(void)
{
goodG2B();
goodB2G();
return;
}
|
['gcc']
|
53,961
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54b_badSink(int count)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_54c_badSink(count);
}
|
[]
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98561/CWE400_Resource_Exhaustion__connect_socket_fwrite_54b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_54b_badSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54b_badSink(undefined4 param_1)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_54c_badSink(param_1);
return;
}
|
['gcc']
|
53,962
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54b_goodG2BSink(int count)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_54c_goodG2BSink(count);
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98561/CWE400_Resource_Exhaustion__connect_socket_fwrite_54b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_54b_goodG2BSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54b_goodG2BSink(undefined4 param_1)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_54c_goodG2BSink(param_1);
return;
}
|
['gcc']
|
53,963
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54b_goodB2GSink(int count)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_54c_goodB2GSink(count);
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98561/CWE400_Resource_Exhaustion__connect_socket_fwrite_54b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_54b_goodB2GSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54b_goodB2GSink(undefined4 param_1)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_54c_goodB2GSink(param_1);
return;
}
|
['gcc']
|
53,964
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54c_badSink(int count)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_54d_badSink(count);
}
|
[]
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98561/CWE400_Resource_Exhaustion__connect_socket_fwrite_54c.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_54c_badSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54c_badSink(undefined4 param_1)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_54d_badSink(param_1);
return;
}
|
['gcc']
|
53,965
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54c_goodG2BSink(int count)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_54d_goodG2BSink(count);
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98561/CWE400_Resource_Exhaustion__connect_socket_fwrite_54c.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_54c_goodG2BSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54c_goodG2BSink(undefined4 param_1)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_54d_goodG2BSink(param_1);
return;
}
|
['gcc']
|
53,966
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54c_goodB2GSink(int count)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_54d_goodB2GSink(count);
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98561/CWE400_Resource_Exhaustion__connect_socket_fwrite_54c.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_54c_goodB2GSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54c_goodB2GSink(undefined4 param_1)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_54d_goodB2GSink(param_1);
return;
}
|
['gcc']
|
53,967
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54d_badSink(int count)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_54e_badSink(count);
}
|
[]
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98561/CWE400_Resource_Exhaustion__connect_socket_fwrite_54d.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_54d_badSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54d_badSink(undefined4 param_1)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_54e_badSink(param_1);
return;
}
|
['gcc']
|
53,968
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54d_goodG2BSink(int count)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_54e_goodG2BSink(count);
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98561/CWE400_Resource_Exhaustion__connect_socket_fwrite_54d.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_54d_goodG2BSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54d_goodG2BSink(undefined4 param_1)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_54e_goodG2BSink(param_1);
return;
}
|
['gcc']
|
53,969
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54d_goodB2GSink(int count)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_54e_goodB2GSink(count);
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98561/CWE400_Resource_Exhaustion__connect_socket_fwrite_54d.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_54d_goodB2GSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54d_goodB2GSink(undefined4 param_1)
{
CWE400_Resource_Exhaustion__connect_socket_fwrite_54e_goodB2GSink(param_1);
return;
}
|
['gcc']
|
53,970
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54e_badSink(int count)
{
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
|
['/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98561/CWE400_Resource_Exhaustion__connect_socket_fwrite_54e.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_54e_badSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54e_badSink(int param_1)
{
long lVar1;
long lVar2;
ulong uStack_10;
lVar1 = func_0x00400db0(&UNK_00401658,&UNK_00401667);
if (lVar1 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)param_1; uStack_10 = uStack_10 + 1) {
lVar2 = func_0x00400df0(&UNK_00401670,1,0x32,lVar1);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar1 != 0) {
func_0x00400ce0(lVar1);
}
return;
}
|
['gcc']
|
53,971
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54e_goodG2BSink(int count)
{
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
|
['/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98561/CWE400_Resource_Exhaustion__connect_socket_fwrite_54e.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_54e_goodG2BSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54e_goodG2BSink(int param_1)
{
long lVar1;
long lVar2;
ulong uStack_10;
lVar1 = func_0x00400db0(&UNK_00401798,&UNK_004017a7);
if (lVar1 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)param_1; uStack_10 = uStack_10 + 1) {
lVar2 = func_0x00400df0(&UNK_004017b0,1,0x32,lVar1);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar1 != 0) {
func_0x00400ce0(lVar1);
}
return;
}
|
['gcc']
|
53,972
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54e_goodB2GSink(int count)
{
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_good.txt";
/* FIX: Validate count before using it as the for loop variant to write to a file */
if (count > 0 && count <= 20)
{
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile)) exit(1);
}
if (pFile)
{
fclose(pFile);
}
}
}
}
|
['/* FIX: Validate count before using it as the for loop variant to write to a file */']
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98561/CWE400_Resource_Exhaustion__connect_socket_fwrite_54e.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_54e_goodB2GSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_54e_goodB2GSink(int param_1)
{
long lVar1;
long lVar2;
ulong uStack_10;
if ((0 < param_1) && (param_1 < 0x15)) {
lVar1 = func_0x00400db0(&UNK_004017e3,&UNK_004017a7);
if (lVar1 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)param_1; uStack_10 = uStack_10 + 1) {
lVar2 = func_0x00400df0(&UNK_004017b0,1,0x32,lVar1);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar1 != 0) {
func_0x00400ce0(lVar1);
}
}
return;
}
|
['gcc']
|
53,973
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_61_bad()
{
int count;
/* Initialize count */
count = -1;
count = CWE400_Resource_Exhaustion__connect_socket_fwrite_61b_badSource(count);
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
|
['/* Initialize count */', '/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98562/CWE400_Resource_Exhaustion__connect_socket_fwrite_61a.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_61_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_61_bad(void)
{
int iVar1;
long lVar2;
long lVar3;
ulong uStack_10;
iVar1 = CWE400_Resource_Exhaustion__connect_socket_fwrite_61b_badSource(0xffffffff);
lVar2 = func_0x00400db0(&UNK_00401618,&UNK_00401627);
if (lVar2 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)iVar1; uStack_10 = uStack_10 + 1) {
lVar3 = func_0x00400df0(&UNK_00401630,1,0x32,lVar2);
if (lVar3 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar2 != 0) {
func_0x00400ce0(lVar2);
}
return;
}
|
['gcc']
|
53,974
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_61_good()
{
goodG2B();
goodB2G();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98562/CWE400_Resource_Exhaustion__connect_socket_fwrite_61a.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_61_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_61_good(void)
{
goodG2B();
goodB2G();
return;
}
|
['gcc']
|
53,975
|
int CWE400_Resource_Exhaustion__connect_socket_fwrite_61b_badSource(int count)
{
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
return count;
}
|
['/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98562/CWE400_Resource_Exhaustion__connect_socket_fwrite_61b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_61b_badSource
|
undefined4 CWE400_Resource_Exhaustion__connect_socket_fwrite_61b_badSource(undefined4 param_1)
{
int iVar1;
undefined4 uStack_3c;
undefined auStack_36 [14];
undefined2 uStack_28;
undefined2 uStack_26;
undefined4 uStack_24;
int iStack_10;
int iStack_c;
iStack_c = 0xffffffff;
iStack_c = func_0x00400e20(2,1,6);
uStack_3c = param_1;
if (iStack_c != -1) {
func_0x00400d10(&uStack_28,0,0x10);
uStack_28 = 2;
uStack_24 = func_0x00400d60(&UNK_00401614);
uStack_26 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_c,&uStack_28,0x10);
if (((iVar1 != -1) && (iStack_10 = func_0x00400cb0(iStack_c,auStack_36,0xd,0), iStack_10 != -1))
&& (iStack_10 != 0)) {
auStack_36[iStack_10] = 0;
uStack_3c = func_0x00400dc0(auStack_36);
}
}
if (iStack_c != -1) {
func_0x00400d20(iStack_c);
}
return uStack_3c;
}
|
['gcc']
|
53,976
|
int CWE400_Resource_Exhaustion__connect_socket_fwrite_61b_goodG2BSource(int count)
{
/* FIX: Use a relatively small number */
count = 20;
return count;
}
|
['/* FIX: Use a relatively small number */']
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98562/CWE400_Resource_Exhaustion__connect_socket_fwrite_61b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_61b_goodG2BSource
|
undefined4 CWE400_Resource_Exhaustion__connect_socket_fwrite_61b_goodG2BSource(void)
{
return 0x14;
}
|
['gcc']
|
53,977
|
int CWE400_Resource_Exhaustion__connect_socket_fwrite_61b_goodB2GSource(int count)
{
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
return count;
}
|
['/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */']
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98562/CWE400_Resource_Exhaustion__connect_socket_fwrite_61b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_61b_goodB2GSource
|
undefined4 CWE400_Resource_Exhaustion__connect_socket_fwrite_61b_goodB2GSource(undefined4 param_1)
{
int iVar1;
undefined4 uStack_3c;
undefined auStack_36 [14];
undefined2 uStack_28;
undefined2 uStack_26;
undefined4 uStack_24;
int iStack_10;
int iStack_c;
iStack_c = 0xffffffff;
iStack_c = func_0x00400e20(2,1,6);
uStack_3c = param_1;
if (iStack_c != -1) {
func_0x00400d10(&uStack_28,0,0x10);
uStack_28 = 2;
uStack_24 = func_0x00400d60(&UNK_00401704);
uStack_26 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_c,&uStack_28,0x10);
if (((iVar1 != -1) && (iStack_10 = func_0x00400cb0(iStack_c,auStack_36,0xd,0), iStack_10 != -1))
&& (iStack_10 != 0)) {
auStack_36[iStack_10] = 0;
uStack_3c = func_0x00400dc0(auStack_36);
}
}
if (iStack_c != -1) {
func_0x00400d20(iStack_c);
}
return uStack_3c;
}
|
['gcc']
|
53,978
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_63_bad()
{
int count;
/* Initialize count */
count = -1;
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
CWE400_Resource_Exhaustion__connect_socket_fwrite_63b_badSink(&count);
}
|
['/* Initialize count */', '/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98564/CWE400_Resource_Exhaustion__connect_socket_fwrite_63a.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_63_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_63_bad(void)
{
int iVar1;
undefined auStack_36 [14];
undefined2 uStack_28;
undefined2 uStack_26;
undefined4 uStack_24;
undefined4 uStack_14;
int iStack_10;
int iStack_c;
uStack_14 = 0xffffffff;
iStack_c = 0xffffffff;
iStack_c = func_0x00400e20(2,1,6);
if (iStack_c != -1) {
func_0x00400d10(&uStack_28,0,0x10);
uStack_28 = 2;
uStack_24 = func_0x00400d60(&UNK_00401624);
uStack_26 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_c,&uStack_28,0x10);
if (((iVar1 != -1) && (iStack_10 = func_0x00400cb0(iStack_c,auStack_36,0xd,0), iStack_10 != -1))
&& (iStack_10 != 0)) {
auStack_36[iStack_10] = 0;
uStack_14 = func_0x00400dc0(auStack_36);
}
}
if (iStack_c != -1) {
func_0x00400d20(iStack_c);
}
CWE400_Resource_Exhaustion__connect_socket_fwrite_63b_badSink(&uStack_14);
return;
}
|
['gcc']
|
53,979
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_63_good()
{
goodG2B();
goodB2G();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98564/CWE400_Resource_Exhaustion__connect_socket_fwrite_63a.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_63_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_63_good(void)
{
goodG2B();
goodB2G();
return;
}
|
['gcc']
|
53,980
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_63b_badSink(int * countPtr)
{
int count = *countPtr;
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
|
['/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98564/CWE400_Resource_Exhaustion__connect_socket_fwrite_63b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_63b_badSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_63b_badSink(int *param_1)
{
int iVar1;
long lVar2;
long lVar3;
ulong uStack_10;
iVar1 = *param_1;
lVar2 = func_0x00400db0(&UNK_00401628,&UNK_00401637);
if (lVar2 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)iVar1; uStack_10 = uStack_10 + 1) {
lVar3 = func_0x00400df0(&UNK_00401640,1,0x32,lVar2);
if (lVar3 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar2 != 0) {
func_0x00400ce0(lVar2);
}
return;
}
|
['gcc']
|
53,981
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_63b_goodG2BSink(int * countPtr)
{
int count = *countPtr;
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
|
['/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98564/CWE400_Resource_Exhaustion__connect_socket_fwrite_63b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_63b_goodG2BSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_63b_goodG2BSink(int *param_1)
{
int iVar1;
long lVar2;
long lVar3;
ulong uStack_10;
iVar1 = *param_1;
lVar2 = func_0x00400db0(&UNK_00401718,&UNK_00401727);
if (lVar2 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)iVar1; uStack_10 = uStack_10 + 1) {
lVar3 = func_0x00400df0(&UNK_00401730,1,0x32,lVar2);
if (lVar3 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar2 != 0) {
func_0x00400ce0(lVar2);
}
return;
}
|
['gcc']
|
53,982
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_63b_goodB2GSink(int * countPtr)
{
int count = *countPtr;
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_good.txt";
/* FIX: Validate count before using it as the for loop variant to write to a file */
if (count > 0 && count <= 20)
{
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile)) exit(1);
}
if (pFile)
{
fclose(pFile);
}
}
}
}
|
['/* FIX: Validate count before using it as the for loop variant to write to a file */']
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98564/CWE400_Resource_Exhaustion__connect_socket_fwrite_63b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_63b_goodB2GSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_63b_goodB2GSink(int *param_1)
{
int iVar1;
long lVar2;
long lVar3;
ulong uStack_10;
iVar1 = *param_1;
if ((0 < iVar1) && (iVar1 < 0x15)) {
lVar2 = func_0x00400db0(&UNK_00401763,&UNK_00401727);
if (lVar2 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)iVar1; uStack_10 = uStack_10 + 1) {
lVar3 = func_0x00400df0(&UNK_00401730,1,0x32,lVar2);
if (lVar3 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar2 != 0) {
func_0x00400ce0(lVar2);
}
}
return;
}
|
['gcc']
|
53,983
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_64_bad()
{
int count;
/* Initialize count */
count = -1;
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
CWE400_Resource_Exhaustion__connect_socket_fwrite_64b_badSink(&count);
}
|
['/* Initialize count */', '/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98565/CWE400_Resource_Exhaustion__connect_socket_fwrite_64a.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_64_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_64_bad(void)
{
int iVar1;
undefined auStack_36 [14];
undefined2 uStack_28;
undefined2 uStack_26;
undefined4 uStack_24;
undefined4 uStack_14;
int iStack_10;
int iStack_c;
uStack_14 = 0xffffffff;
iStack_c = 0xffffffff;
iStack_c = func_0x00400e20(2,1,6);
if (iStack_c != -1) {
func_0x00400d10(&uStack_28,0,0x10);
uStack_28 = 2;
uStack_24 = func_0x00400d60(&UNK_00401624);
uStack_26 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_c,&uStack_28,0x10);
if (((iVar1 != -1) && (iStack_10 = func_0x00400cb0(iStack_c,auStack_36,0xd,0), iStack_10 != -1))
&& (iStack_10 != 0)) {
auStack_36[iStack_10] = 0;
uStack_14 = func_0x00400dc0(auStack_36);
}
}
if (iStack_c != -1) {
func_0x00400d20(iStack_c);
}
CWE400_Resource_Exhaustion__connect_socket_fwrite_64b_badSink(&uStack_14);
return;
}
|
['gcc']
|
53,984
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_64_good()
{
goodG2B();
goodB2G();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98565/CWE400_Resource_Exhaustion__connect_socket_fwrite_64a.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_64_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_64_good(void)
{
goodG2B();
goodB2G();
return;
}
|
['gcc']
|
53,985
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_64b_badSink(void * countVoidPtr)
{
/* cast void pointer to a pointer of the appropriate type */
int * countPtr = (int *)countVoidPtr;
/* dereference countPtr into count */
int count = (*countPtr);
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
|
['/* cast void pointer to a pointer of the appropriate type */', '/* dereference countPtr into count */', '/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98565/CWE400_Resource_Exhaustion__connect_socket_fwrite_64b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_64b_badSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_64b_badSink(int *param_1)
{
int iVar1;
long lVar2;
long lVar3;
ulong uStack_10;
iVar1 = *param_1;
lVar2 = func_0x00400db0(&UNK_00401628,&UNK_00401637);
if (lVar2 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)iVar1; uStack_10 = uStack_10 + 1) {
lVar3 = func_0x00400df0(&UNK_00401640,1,0x32,lVar2);
if (lVar3 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar2 != 0) {
func_0x00400ce0(lVar2);
}
return;
}
|
['gcc']
|
53,986
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_64b_goodG2BSink(void * countVoidPtr)
{
/* cast void pointer to a pointer of the appropriate type */
int * countPtr = (int *)countVoidPtr;
/* dereference countPtr into count */
int count = (*countPtr);
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
|
['/* cast void pointer to a pointer of the appropriate type */', '/* dereference countPtr into count */', '/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98565/CWE400_Resource_Exhaustion__connect_socket_fwrite_64b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_64b_goodG2BSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_64b_goodG2BSink(int *param_1)
{
int iVar1;
long lVar2;
long lVar3;
ulong uStack_10;
iVar1 = *param_1;
lVar2 = func_0x00400db0(&UNK_00401728,&UNK_00401737);
if (lVar2 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)iVar1; uStack_10 = uStack_10 + 1) {
lVar3 = func_0x00400df0(&UNK_00401740,1,0x32,lVar2);
if (lVar3 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar2 != 0) {
func_0x00400ce0(lVar2);
}
return;
}
|
['gcc']
|
53,987
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_64b_goodB2GSink(void * countVoidPtr)
{
/* cast void pointer to a pointer of the appropriate type */
int * countPtr = (int *)countVoidPtr;
/* dereference countPtr into count */
int count = (*countPtr);
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_good.txt";
/* FIX: Validate count before using it as the for loop variant to write to a file */
if (count > 0 && count <= 20)
{
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile)) exit(1);
}
if (pFile)
{
fclose(pFile);
}
}
}
}
|
['/* cast void pointer to a pointer of the appropriate type */', '/* dereference countPtr into count */', '/* FIX: Validate count before using it as the for loop variant to write to a file */']
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98565/CWE400_Resource_Exhaustion__connect_socket_fwrite_64b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_64b_goodB2GSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_64b_goodB2GSink(int *param_1)
{
int iVar1;
long lVar2;
long lVar3;
ulong uStack_10;
iVar1 = *param_1;
if ((0 < iVar1) && (iVar1 < 0x15)) {
lVar2 = func_0x00400db0(&UNK_00401773,&UNK_00401737);
if (lVar2 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)iVar1; uStack_10 = uStack_10 + 1) {
lVar3 = func_0x00400df0(&UNK_00401740,1,0x32,lVar2);
if (lVar3 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar2 != 0) {
func_0x00400ce0(lVar2);
}
}
return;
}
|
['gcc']
|
53,988
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_65_bad()
{
int count;
/* define a function pointer */
void (*funcPtr) (int) = CWE400_Resource_Exhaustion__connect_socket_fwrite_65b_badSink;
/* Initialize count */
count = -1;
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
/* use the function pointer */
funcPtr(count);
}
|
['/* define a function pointer */', '/* Initialize count */', '/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */', '/* use the function pointer */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98566/CWE400_Resource_Exhaustion__connect_socket_fwrite_65a.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_65_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_65_bad(void)
{
int iVar1;
undefined auStack_46 [14];
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
int iStack_20;
int iStack_1c;
code *pcStack_18;
undefined4 uStack_c;
pcStack_18 = CWE400_Resource_Exhaustion__connect_socket_fwrite_65b_badSink;
uStack_c = 0xffffffff;
iStack_1c = 0xffffffff;
iStack_1c = func_0x00400e20(2,1,6);
if (iStack_1c != -1) {
func_0x00400d10(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = func_0x00400d60(&UNK_00401614);
uStack_36 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_1c,&uStack_38,0x10);
if (((iVar1 != -1) && (iStack_20 = func_0x00400cb0(iStack_1c,auStack_46,0xd,0), iStack_20 != -1)
) && (iStack_20 != 0)) {
auStack_46[iStack_20] = 0;
uStack_c = func_0x00400dc0(auStack_46);
}
}
if (iStack_1c != -1) {
func_0x00400d20(iStack_1c);
}
(*pcStack_18)(uStack_c);
return;
}
|
['gcc']
|
53,989
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_65_good()
{
goodG2B();
goodB2G();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98566/CWE400_Resource_Exhaustion__connect_socket_fwrite_65a.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_65_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_65_good(void)
{
goodG2B();
goodB2G();
return;
}
|
['gcc']
|
53,990
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_65b_badSink(int count)
{
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
|
['/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98566/CWE400_Resource_Exhaustion__connect_socket_fwrite_65b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_65b_badSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_65b_badSink(int param_1)
{
long lVar1;
long lVar2;
ulong uStack_10;
lVar1 = func_0x00400db0(&UNK_00401618,&UNK_00401627);
if (lVar1 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)param_1; uStack_10 = uStack_10 + 1) {
lVar2 = func_0x00400df0(&UNK_00401630,1,0x32,lVar1);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar1 != 0) {
func_0x00400ce0(lVar1);
}
return;
}
|
['gcc']
|
53,991
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_65b_goodG2BSink(int count)
{
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
|
['/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98566/CWE400_Resource_Exhaustion__connect_socket_fwrite_65b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_65b_goodG2BSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_65b_goodG2BSink(int param_1)
{
long lVar1;
long lVar2;
ulong uStack_10;
lVar1 = func_0x00400db0(&UNK_00401718,&UNK_00401727);
if (lVar1 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)param_1; uStack_10 = uStack_10 + 1) {
lVar2 = func_0x00400df0(&UNK_00401730,1,0x32,lVar1);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar1 != 0) {
func_0x00400ce0(lVar1);
}
return;
}
|
['gcc']
|
53,992
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_65b_goodB2GSink(int count)
{
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_good.txt";
/* FIX: Validate count before using it as the for loop variant to write to a file */
if (count > 0 && count <= 20)
{
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile)) exit(1);
}
if (pFile)
{
fclose(pFile);
}
}
}
}
|
['/* FIX: Validate count before using it as the for loop variant to write to a file */']
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98566/CWE400_Resource_Exhaustion__connect_socket_fwrite_65b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_65b_goodB2GSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_65b_goodB2GSink(int param_1)
{
long lVar1;
long lVar2;
ulong uStack_10;
if ((0 < param_1) && (param_1 < 0x15)) {
lVar1 = func_0x00400db0(&UNK_00401763,&UNK_00401727);
if (lVar1 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)param_1; uStack_10 = uStack_10 + 1) {
lVar2 = func_0x00400df0(&UNK_00401730,1,0x32,lVar1);
if (lVar2 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar1 != 0) {
func_0x00400ce0(lVar1);
}
}
return;
}
|
['gcc']
|
53,993
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_66_bad()
{
int count;
int countArray[5];
/* Initialize count */
count = -1;
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
/* put count in array */
countArray[2] = count;
CWE400_Resource_Exhaustion__connect_socket_fwrite_66b_badSink(countArray);
}
|
['/* Initialize count */', '/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */', '/* put count in array */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98567/CWE400_Resource_Exhaustion__connect_socket_fwrite_66a.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_66_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_66_bad(void)
{
int iVar1;
undefined auStack_46 [14];
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined auStack_28 [8];
undefined4 uStack_20;
int iStack_14;
int iStack_10;
undefined4 uStack_c;
uStack_c = 0xffffffff;
iStack_10 = 0xffffffff;
iStack_10 = func_0x00400e20(2,1,6);
if (iStack_10 != -1) {
func_0x00400d10(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = func_0x00400d60(&UNK_00401624);
uStack_36 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_10,&uStack_38,0x10);
if (((iVar1 != -1) && (iStack_14 = func_0x00400cb0(iStack_10,auStack_46,0xd,0), iStack_14 != -1)
) && (iStack_14 != 0)) {
auStack_46[iStack_14] = 0;
uStack_c = func_0x00400dc0(auStack_46);
}
}
if (iStack_10 != -1) {
func_0x00400d20(iStack_10);
}
uStack_20 = uStack_c;
CWE400_Resource_Exhaustion__connect_socket_fwrite_66b_badSink(auStack_28);
return;
}
|
['gcc']
|
53,994
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_66_good()
{
goodG2B();
goodB2G();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98567/CWE400_Resource_Exhaustion__connect_socket_fwrite_66a.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_66_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_66_good(void)
{
goodG2B();
goodB2G();
return;
}
|
['gcc']
|
53,995
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_66b_badSink(int countArray[])
{
/* copy count out of countArray */
int count = countArray[2];
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
|
['/* copy count out of countArray */', '/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98567/CWE400_Resource_Exhaustion__connect_socket_fwrite_66b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_66b_badSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_66b_badSink(long param_1)
{
int iVar1;
long lVar2;
long lVar3;
ulong uStack_10;
iVar1 = *(int *)(param_1 + 8);
lVar2 = func_0x00400db0(&UNK_00401628,&UNK_00401637);
if (lVar2 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)iVar1; uStack_10 = uStack_10 + 1) {
lVar3 = func_0x00400df0(&UNK_00401640,1,0x32,lVar2);
if (lVar3 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar2 != 0) {
func_0x00400ce0(lVar2);
}
return;
}
|
['gcc']
|
53,996
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_66b_goodG2BSink(int countArray[])
{
int count = countArray[2];
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_bad.txt";
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
/* POTENTIAL FLAW: For loop using count as the loop variant and no validation
* This can cause a file to become very large */
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile))
{
exit(1);
}
}
if (pFile)
{
fclose(pFile);
}
}
}
|
['/* POTENTIAL FLAW: For loop using count as the loop variant and no validation\r\n * This can cause a file to become very large */']
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98567/CWE400_Resource_Exhaustion__connect_socket_fwrite_66b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_66b_goodG2BSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_66b_goodG2BSink(long param_1)
{
int iVar1;
long lVar2;
long lVar3;
ulong uStack_10;
iVar1 = *(int *)(param_1 + 8);
lVar2 = func_0x00400db0(&UNK_00401728,&UNK_00401737);
if (lVar2 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)iVar1; uStack_10 = uStack_10 + 1) {
lVar3 = func_0x00400df0(&UNK_00401740,1,0x32,lVar2);
if (lVar3 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar2 != 0) {
func_0x00400ce0(lVar2);
}
return;
}
|
['gcc']
|
53,997
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_66b_goodB2GSink(int countArray[])
{
int count = countArray[2];
{
size_t i = 0;
FILE *pFile = NULL;
const char *filename = "output_good.txt";
/* FIX: Validate count before using it as the for loop variant to write to a file */
if (count > 0 && count <= 20)
{
pFile = fopen(filename, "w+");
if (pFile == NULL)
{
exit(1);
}
for (i = 0; i < (size_t)count; i++)
{
if (strlen(SENTENCE) != fwrite(SENTENCE, sizeof(char), strlen(SENTENCE), pFile)) exit(1);
}
if (pFile)
{
fclose(pFile);
}
}
}
}
|
['/* FIX: Validate count before using it as the for loop variant to write to a file */']
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98567/CWE400_Resource_Exhaustion__connect_socket_fwrite_66b.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_66b_goodB2GSink
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_66b_goodB2GSink(long param_1)
{
int iVar1;
long lVar2;
long lVar3;
ulong uStack_10;
iVar1 = *(int *)(param_1 + 8);
if ((0 < iVar1) && (iVar1 < 0x15)) {
lVar2 = func_0x00400db0(&UNK_00401773,&UNK_00401737);
if (lVar2 == 0) {
func_0x00400dd0(1);
}
for (uStack_10 = 0; uStack_10 < (ulong)(long)iVar1; uStack_10 = uStack_10 + 1) {
lVar3 = func_0x00400df0(&UNK_00401740,1,0x32,lVar2);
if (lVar3 != 0x32) {
func_0x00400dd0(1);
}
}
if (lVar2 != 0) {
func_0x00400ce0(lVar2);
}
}
return;
}
|
['gcc']
|
53,998
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_67_bad()
{
int count;
CWE400_Resource_Exhaustion__connect_socket_fwrite_67_structType myStruct;
/* Initialize count */
count = -1;
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read count using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to int */
count = atoi(inputBuffer);
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
myStruct.structFirst = count;
CWE400_Resource_Exhaustion__connect_socket_fwrite_67b_badSink(myStruct);
}
|
['/* Initialize count */', '/* POTENTIAL FLAW: Read count using a connect socket */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* NUL-terminate the string */', '/* Convert to int */']
|
['CWE400']
|
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98568/CWE400_Resource_Exhaustion__connect_socket_fwrite_67a.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_67_bad
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_67_bad(void)
{
int iVar1;
undefined auStack_36 [14];
undefined2 uStack_28;
undefined2 uStack_26;
undefined4 uStack_24;
undefined4 uStack_18;
int iStack_14;
int iStack_10;
undefined4 uStack_c;
uStack_c = 0xffffffff;
iStack_10 = 0xffffffff;
iStack_10 = func_0x00400e20(2,1,6);
if (iStack_10 != -1) {
func_0x00400d10(&uStack_28,0,0x10);
uStack_28 = 2;
uStack_24 = func_0x00400d60(&UNK_00401624);
uStack_26 = func_0x00400cf0(0x6987);
iVar1 = func_0x00400de0(iStack_10,&uStack_28,0x10);
if (((iVar1 != -1) && (iStack_14 = func_0x00400cb0(iStack_10,auStack_36,0xd,0), iStack_14 != -1)
) && (iStack_14 != 0)) {
auStack_36[iStack_14] = 0;
uStack_c = func_0x00400dc0(auStack_36);
}
}
if (iStack_10 != -1) {
func_0x00400d20(iStack_10);
}
uStack_18 = uStack_c;
CWE400_Resource_Exhaustion__connect_socket_fwrite_67b_badSink(uStack_c);
return;
}
|
['gcc']
|
53,999
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_67_good()
{
goodG2B();
goodB2G();
}
|
[]
| null |
mvd
|
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/98568/CWE400_Resource_Exhaustion__connect_socket_fwrite_67a.c
|
CWE400_Resource_Exhaustion__connect_socket_fwrite_67_good
|
void CWE400_Resource_Exhaustion__connect_socket_fwrite_67_good(void)
{
goodG2B();
goodB2G();
return;
}
|
['gcc']
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.