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 |
|---|---|---|---|---|---|---|---|---|
6,900 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_01_good()
{
good1();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109981/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_01.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_01_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_01_good(void)
{
good1();
return;
}
| ['gcc'] |
6,901 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_02_bad()
{
if(1)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to bind(), accept(), then listen() */
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to bind(), accept(), then listen() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109982/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_02.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_02_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_02_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d30(iStack_10,5), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
return;
}
| ['gcc'] |
6,902 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_02_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109982/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_02.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_02_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_02_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,903 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_03_bad()
{
if(5==5)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to bind(), accept(), then listen() */
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to bind(), accept(), then listen() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109983/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_03.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_03_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_03_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d30(iStack_10,5), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
return;
}
| ['gcc'] |
6,904 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_03_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109983/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_03.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_03_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_03_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,905 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_04_bad()
{
if(STATIC_CONST_TRUE)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to bind(), accept(), then listen() */
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to bind(), accept(), then listen() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109984/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_04.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_04_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_04_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d30(iStack_10,5), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
return;
}
| ['gcc'] |
6,906 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_04_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109984/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_04.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_04_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_04_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,907 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_05_bad()
{
if(staticTrue)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to bind(), accept(), then listen() */
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to bind(), accept(), then listen() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109985/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_05.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_05_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_05_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
if (staticTrue != 0) {
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d30(iStack_10,5), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
}
return;
}
| ['gcc'] |
6,908 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_05_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109985/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_05.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_05_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_05_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,909 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_06_bad()
{
if(STATIC_CONST_FIVE==5)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to bind(), accept(), then listen() */
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to bind(), accept(), then listen() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109986/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_06.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_06_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_06_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d30(iStack_10,5), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
return;
}
| ['gcc'] |
6,910 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_06_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109986/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_06.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_06_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_06_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,911 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_07_bad()
{
if(staticFive==5)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to bind(), accept(), then listen() */
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to bind(), accept(), then listen() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109987/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_07.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_07_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_07_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
if (staticFive == 5) {
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d30(iStack_10,5), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
}
return;
}
| ['gcc'] |
6,912 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_07_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109987/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_07.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_07_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_07_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,913 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_08_bad()
{
if(staticReturnsTrue())
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to bind(), accept(), then listen() */
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to bind(), accept(), then listen() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109988/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_08.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_08_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_08_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
iVar1 = staticReturnsTrue();
if (iVar1 != 0) {
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d30(iStack_10,5), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
}
return;
}
| ['gcc'] |
6,914 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_08_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109988/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_08.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_08_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_08_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,915 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_09_bad()
{
if(GLOBAL_CONST_TRUE)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to bind(), accept(), then listen() */
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to bind(), accept(), then listen() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109989/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_09.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_09_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_09_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
if (GLOBAL_CONST_TRUE != 0) {
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d30(iStack_10,5), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
}
return;
}
| ['gcc'] |
6,916 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_09_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109989/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_09.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_09_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_09_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,917 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_10_bad()
{
if(globalTrue)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to bind(), accept(), then listen() */
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to bind(), accept(), then listen() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109990/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_10.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_10_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_10_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
if (globalTrue != 0) {
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d30(iStack_10,5), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
}
return;
}
| ['gcc'] |
6,918 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_10_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109990/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_10.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_10_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_10_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,919 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_11_bad()
{
if(globalReturnsTrue())
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to bind(), accept(), then listen() */
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to bind(), accept(), then listen() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109991/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_11.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_11_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_11_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
iVar1 = globalReturnsTrue();
if (iVar1 != 0) {
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d30(iStack_10,5), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
}
return;
}
| ['gcc'] |
6,920 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_11_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109991/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_11.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_11_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_11_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,921 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_12_bad()
{
if(globalReturnsTrueOrFalse())
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to bind(), accept(), then listen() */
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
else
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FIX: bind(), listen(), then accept() */
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to bind(), accept(), then listen() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */', '/* FIX: bind(), listen(), then accept() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109992/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_12.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_12_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_12_bad(void)
{
int iVar1;
undefined8 uStack_e8;
undefined8 uStack_e0;
undefined8 uStack_d8;
undefined8 uStack_d0;
undefined8 uStack_c8;
undefined8 uStack_c0;
undefined8 uStack_b8;
undefined8 uStack_b0;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined4 uStack_88;
undefined2 uStack_78;
undefined2 uStack_76;
undefined4 uStack_74;
undefined2 uStack_68;
undefined2 uStack_66;
undefined4 uStack_64;
undefined *puStack_50;
int iStack_44;
long lStack_40;
int iStack_34;
undefined *puStack_30;
int iStack_24;
long lStack_20;
int iStack_14;
int iStack_10;
int iStack_c;
iVar1 = globalReturnsTrueOrFalse();
if (iVar1 == 0) {
uStack_e8 = 0;
uStack_e0 = 0;
uStack_d8 = 0;
uStack_d0 = 0;
uStack_c8 = 0;
uStack_c0 = 0;
uStack_b8 = 0;
uStack_b0 = 0;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
iStack_14 = 0xffffffff;
iStack_10 = -1;
lStack_20 = func_0x00400c60(&uStack_e8);
iStack_14 = func_0x00400d80(2,1,6);
if (iStack_14 != -1) {
func_0x00400ca0(&uStack_78,0,0x10);
uStack_78 = 2;
uStack_74 = 0;
uStack_76 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d40(iStack_14,&uStack_78,0x10);
if ((((iVar1 != -1) && (iVar1 = func_0x00400d30(iStack_14,5), iVar1 != -1)) &&
(iStack_10 = func_0x00400d50(iStack_14,0,0), iStack_10 != -1)) &&
((iStack_24 = func_0x00400c30(iStack_10,(long)&uStack_e8 + lStack_20,
(long)(99 - (int)lStack_20),0), iStack_24 != -1 &&
(iStack_24 != 0)))) {
*(undefined *)((long)&uStack_e8 + (long)iStack_24) = 0;
puStack_30 = (undefined *)func_0x00400c80(&uStack_e8,0xd);
if (puStack_30 != (undefined *)0x0) {
*puStack_30 = 0;
}
puStack_30 = (undefined *)func_0x00400c80(&uStack_e8,10);
if (puStack_30 != (undefined *)0x0) {
*puStack_30 = 0;
}
}
}
if (iStack_14 != -1) {
func_0x00400cb0(iStack_14);
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
printLine(&uStack_e8);
}
else {
uStack_e8 = 0;
uStack_e0 = 0;
uStack_d8 = 0;
uStack_d0 = 0;
uStack_c8 = 0;
uStack_c0 = 0;
uStack_b8 = 0;
uStack_b0 = 0;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
iStack_34 = 0xffffffff;
iStack_c = -1;
lStack_40 = func_0x00400c60(&uStack_e8);
iStack_34 = func_0x00400d80(2,1,6);
if (iStack_34 != -1) {
func_0x00400ca0(&uStack_68,0,0x10);
uStack_68 = 2;
uStack_64 = 0;
uStack_66 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d40(iStack_34,&uStack_68,0x10);
if (((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_34,0,0), iStack_c != -1)) &&
((iVar1 = func_0x00400d30(iStack_34,5), iVar1 != -1 &&
((iStack_44 = func_0x00400c30(iStack_c,(long)&uStack_e8 + lStack_40,
(long)(99 - (int)lStack_40),0), iStack_44 != -1 &&
(iStack_44 != 0)))))) {
*(undefined *)((long)&uStack_e8 + (long)iStack_44) = 0;
puStack_50 = (undefined *)func_0x00400c80(&uStack_e8,0xd);
if (puStack_50 != (undefined *)0x0) {
*puStack_50 = 0;
}
puStack_50 = (undefined *)func_0x00400c80(&uStack_e8,10);
if (puStack_50 != (undefined *)0x0) {
*puStack_50 = 0;
}
}
}
if (iStack_34 != -1) {
func_0x00400cb0(iStack_34);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_e8);
}
return;
}
| ['gcc'] |
6,922 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_12_good()
{
good1();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109992/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_12.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_12_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_12_good(void)
{
good1();
return;
}
| ['gcc'] |
6,923 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_13_bad()
{
if(GLOBAL_CONST_FIVE==5)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to bind(), accept(), then listen() */
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to bind(), accept(), then listen() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109993/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_13.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_13_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_13_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
if (GLOBAL_CONST_FIVE == 5) {
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d30(iStack_10,5), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
}
return;
}
| ['gcc'] |
6,924 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_13_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109993/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_13.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_13_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_13_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,925 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_14_bad()
{
if(globalFive==5)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to bind(), accept(), then listen() */
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to bind(), accept(), then listen() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109994/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_14.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_14_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_14_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
if (globalFive == 5) {
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d30(iStack_10,5), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
}
return;
}
| ['gcc'] |
6,926 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_14_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109994/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_14.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_14_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_14_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,927 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_15_bad()
{
switch(6)
{
case 6:
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to bind(), accept(), then listen() */
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
} | ['/* FLAW: Attempt to bind(), accept(), then listen() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */', '/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109995/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_15.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_15_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_15_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d30(iStack_10,5), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
return;
}
| ['gcc'] |
6,928 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_15_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109995/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_15.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_15_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_15_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,929 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_16_bad()
{
while(1)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to bind(), accept(), then listen() */
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
break;
}
} | ['/* FLAW: Attempt to bind(), accept(), then listen() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109996/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_16.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_16_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_16_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d30(iStack_10,5), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
return;
}
| ['gcc'] |
6,930 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_16_good()
{
good1();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109996/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_16.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_16_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_16_good(void)
{
good1();
return;
}
| ['gcc'] |
6,931 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_17_bad()
{
int j;
for(j = 0; j < 1; j++)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to bind(), accept(), then listen() */
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to bind(), accept(), then listen() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109997/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_17.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_17_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_17_bad(void)
{
int iVar1;
undefined8 uStack_b8;
undefined8 uStack_b0;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined4 uStack_58;
undefined2 uStack_48;
undefined2 uStack_46;
undefined4 uStack_44;
undefined *puStack_30;
int iStack_24;
long lStack_20;
int iStack_14;
int iStack_10;
int iStack_c;
for (iStack_c = 0; iStack_c < 1; iStack_c = iStack_c + 1) {
uStack_b8 = 0;
uStack_b0 = 0;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
iStack_14 = 0xffffffff;
iStack_10 = -1;
lStack_20 = func_0x00400c60(&uStack_b8);
iStack_14 = func_0x00400d80(2,1,6);
if (iStack_14 != -1) {
func_0x00400ca0(&uStack_48,0,0x10);
uStack_48 = 2;
uStack_44 = 0;
uStack_46 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d40(iStack_14,&uStack_48,0x10);
if ((((iVar1 != -1) && (iStack_10 = func_0x00400d50(iStack_14,0,0), iStack_10 != -1)) &&
(iVar1 = func_0x00400d30(iStack_14,5), iVar1 != -1)) &&
((iStack_24 = func_0x00400c30(iStack_10,(long)&uStack_b8 + lStack_20,
(long)(99 - (int)lStack_20),0), iStack_24 != -1 &&
(iStack_24 != 0)))) {
*(undefined *)((long)&uStack_b8 + (long)iStack_24) = 0;
puStack_30 = (undefined *)func_0x00400c80(&uStack_b8,0xd);
if (puStack_30 != (undefined *)0x0) {
*puStack_30 = 0;
}
puStack_30 = (undefined *)func_0x00400c80(&uStack_b8,10);
if (puStack_30 != (undefined *)0x0) {
*puStack_30 = 0;
}
}
}
if (iStack_14 != -1) {
func_0x00400cb0(iStack_14);
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
printLine(&uStack_b8);
}
return;
}
| ['gcc'] |
6,932 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_17_good()
{
good1();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109997/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_17.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_17_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_17_good(void)
{
good1();
return;
}
| ['gcc'] |
6,933 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_18_bad()
{
goto sink;
sink:
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to bind(), accept(), then listen() */
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
} | ['/* FLAW: Attempt to bind(), accept(), then listen() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109998/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_18.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_18_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_18_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d30(iStack_10,5), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
return;
}
| ['gcc'] |
6,934 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_18_good()
{
good1();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109998/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_18.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_18_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__bind_accept_listen_18_good(void)
{
good1();
return;
}
| ['gcc'] |
6,935 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_01_bad()
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), accept(), then bind() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
} | ['/* FLAW: Attempt to listen(), accept(), then bind() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109999/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_01.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_01_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_01_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_10,5);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
return;
}
| ['gcc'] |
6,936 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_01_good()
{
good1();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/109999/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_01.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_01_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_01_good(void)
{
good1();
return;
}
| ['gcc'] |
6,937 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_02_bad()
{
if(1)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), accept(), then bind() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to listen(), accept(), then bind() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110000/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_02.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_02_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_02_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_10,5);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
return;
}
| ['gcc'] |
6,938 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_02_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110000/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_02.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_02_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_02_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,939 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_03_bad()
{
if(5==5)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), accept(), then bind() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to listen(), accept(), then bind() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110001/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_03.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_03_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_03_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_10,5);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
return;
}
| ['gcc'] |
6,940 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_03_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110001/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_03.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_03_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_03_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,941 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_04_bad()
{
if(STATIC_CONST_TRUE)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), accept(), then bind() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to listen(), accept(), then bind() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110002/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_04.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_04_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_04_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_10,5);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
return;
}
| ['gcc'] |
6,942 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_04_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110002/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_04.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_04_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_04_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,943 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_05_bad()
{
if(staticTrue)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), accept(), then bind() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to listen(), accept(), then bind() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110003/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_05.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_05_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_05_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
if (staticTrue != 0) {
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_10,5);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
}
return;
}
| ['gcc'] |
6,944 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_05_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110003/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_05.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_05_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_05_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,945 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_06_bad()
{
if(STATIC_CONST_FIVE==5)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), accept(), then bind() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to listen(), accept(), then bind() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110004/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_06.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_06_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_06_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_10,5);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
return;
}
| ['gcc'] |
6,946 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_06_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110004/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_06.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_06_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_06_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,947 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_07_bad()
{
if(staticFive==5)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), accept(), then bind() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to listen(), accept(), then bind() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110005/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_07.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_07_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_07_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
if (staticFive == 5) {
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_10,5);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
}
return;
}
| ['gcc'] |
6,948 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_07_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110005/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_07.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_07_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_07_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,949 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_08_bad()
{
if(staticReturnsTrue())
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), accept(), then bind() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to listen(), accept(), then bind() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110006/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_08.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_08_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_08_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
iVar1 = staticReturnsTrue();
if (iVar1 != 0) {
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_10,5);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
}
return;
}
| ['gcc'] |
6,950 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_08_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110006/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_08.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_08_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_08_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,951 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_09_bad()
{
if(GLOBAL_CONST_TRUE)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), accept(), then bind() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to listen(), accept(), then bind() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110007/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_09.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_09_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_09_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
if (GLOBAL_CONST_TRUE != 0) {
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_10,5);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
}
return;
}
| ['gcc'] |
6,952 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_09_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110007/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_09.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_09_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_09_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,953 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_10_bad()
{
if(globalTrue)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), accept(), then bind() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to listen(), accept(), then bind() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110008/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_10.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_10_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_10_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
if (globalTrue != 0) {
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_10,5);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
}
return;
}
| ['gcc'] |
6,954 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_10_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110008/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_10.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_10_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_10_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,955 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_11_bad()
{
if(globalReturnsTrue())
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), accept(), then bind() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to listen(), accept(), then bind() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110009/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_11.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_11_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_11_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
iVar1 = globalReturnsTrue();
if (iVar1 != 0) {
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_10,5);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
}
return;
}
| ['gcc'] |
6,956 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_11_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110009/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_11.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_11_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_11_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,957 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_12_bad()
{
if(globalReturnsTrueOrFalse())
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), accept(), then bind() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
else
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FIX: bind(), listen(), then accept() */
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to listen(), accept(), then bind() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */', '/* FIX: bind(), listen(), then accept() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110010/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_12.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_12_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_12_bad(void)
{
int iVar1;
undefined8 uStack_e8;
undefined8 uStack_e0;
undefined8 uStack_d8;
undefined8 uStack_d0;
undefined8 uStack_c8;
undefined8 uStack_c0;
undefined8 uStack_b8;
undefined8 uStack_b0;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined4 uStack_88;
undefined2 uStack_78;
undefined2 uStack_76;
undefined4 uStack_74;
undefined2 uStack_68;
undefined2 uStack_66;
undefined4 uStack_64;
undefined *puStack_50;
int iStack_44;
long lStack_40;
int iStack_34;
undefined *puStack_30;
int iStack_24;
long lStack_20;
int iStack_14;
int iStack_10;
int iStack_c;
iVar1 = globalReturnsTrueOrFalse();
if (iVar1 == 0) {
uStack_e8 = 0;
uStack_e0 = 0;
uStack_d8 = 0;
uStack_d0 = 0;
uStack_c8 = 0;
uStack_c0 = 0;
uStack_b8 = 0;
uStack_b0 = 0;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
iStack_14 = 0xffffffff;
iStack_10 = -1;
lStack_20 = func_0x00400c60(&uStack_e8);
iStack_14 = func_0x00400d80(2,1,6);
if (iStack_14 != -1) {
func_0x00400ca0(&uStack_78,0,0x10);
uStack_78 = 2;
uStack_74 = 0;
uStack_76 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d40(iStack_14,&uStack_78,0x10);
if ((((iVar1 != -1) && (iVar1 = func_0x00400d30(iStack_14,5), iVar1 != -1)) &&
(iStack_10 = func_0x00400d50(iStack_14,0,0), iStack_10 != -1)) &&
((iStack_24 = func_0x00400c30(iStack_10,(long)&uStack_e8 + lStack_20,
(long)(99 - (int)lStack_20),0), iStack_24 != -1 &&
(iStack_24 != 0)))) {
*(undefined *)((long)&uStack_e8 + (long)iStack_24) = 0;
puStack_30 = (undefined *)func_0x00400c80(&uStack_e8,0xd);
if (puStack_30 != (undefined *)0x0) {
*puStack_30 = 0;
}
puStack_30 = (undefined *)func_0x00400c80(&uStack_e8,10);
if (puStack_30 != (undefined *)0x0) {
*puStack_30 = 0;
}
}
}
if (iStack_14 != -1) {
func_0x00400cb0(iStack_14);
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
printLine(&uStack_e8);
}
else {
uStack_e8 = 0;
uStack_e0 = 0;
uStack_d8 = 0;
uStack_d0 = 0;
uStack_c8 = 0;
uStack_c0 = 0;
uStack_b8 = 0;
uStack_b0 = 0;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
iStack_34 = 0xffffffff;
iStack_c = -1;
lStack_40 = func_0x00400c60(&uStack_e8);
iStack_34 = func_0x00400d80(2,1,6);
if (iStack_34 != -1) {
func_0x00400ca0(&uStack_68,0,0x10);
uStack_68 = 2;
uStack_64 = 0;
uStack_66 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_34,5);
if (((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_34,0,0), iStack_c != -1)) &&
((iVar1 = func_0x00400d40(iStack_34,&uStack_68,0x10), iVar1 != -1 &&
((iStack_44 = func_0x00400c30(iStack_c,(long)&uStack_e8 + lStack_40,
(long)(99 - (int)lStack_40),0), iStack_44 != -1 &&
(iStack_44 != 0)))))) {
*(undefined *)((long)&uStack_e8 + (long)iStack_44) = 0;
puStack_50 = (undefined *)func_0x00400c80(&uStack_e8,0xd);
if (puStack_50 != (undefined *)0x0) {
*puStack_50 = 0;
}
puStack_50 = (undefined *)func_0x00400c80(&uStack_e8,10);
if (puStack_50 != (undefined *)0x0) {
*puStack_50 = 0;
}
}
}
if (iStack_34 != -1) {
func_0x00400cb0(iStack_34);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_e8);
}
return;
}
| ['gcc'] |
6,958 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_12_good()
{
good1();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110010/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_12.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_12_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_12_good(void)
{
good1();
return;
}
| ['gcc'] |
6,959 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_13_bad()
{
if(GLOBAL_CONST_FIVE==5)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), accept(), then bind() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to listen(), accept(), then bind() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110011/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_13.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_13_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_13_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
if (GLOBAL_CONST_FIVE == 5) {
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_10,5);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
}
return;
}
| ['gcc'] |
6,960 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_13_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110011/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_13.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_13_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_13_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,961 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_14_bad()
{
if(globalFive==5)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), accept(), then bind() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to listen(), accept(), then bind() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110012/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_14.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_14_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_14_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
if (globalFive == 5) {
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_10,5);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
}
return;
}
| ['gcc'] |
6,962 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_14_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110012/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_14.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_14_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_14_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,963 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_15_bad()
{
switch(6)
{
case 6:
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), accept(), then bind() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
} | ['/* FLAW: Attempt to listen(), accept(), then bind() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */', '/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110013/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_15.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_15_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_15_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_10,5);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
return;
}
| ['gcc'] |
6,964 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_15_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110013/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_15.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_15_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_15_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,965 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_16_bad()
{
while(1)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), accept(), then bind() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
break;
}
} | ['/* FLAW: Attempt to listen(), accept(), then bind() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110014/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_16.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_16_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_16_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_10,5);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
return;
}
| ['gcc'] |
6,966 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_16_good()
{
good1();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110014/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_16.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_16_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_16_good(void)
{
good1();
return;
}
| ['gcc'] |
6,967 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_17_bad()
{
int j;
for(j = 0; j < 1; j++)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), accept(), then bind() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to listen(), accept(), then bind() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110015/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_17.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_17_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_17_bad(void)
{
int iVar1;
undefined8 uStack_b8;
undefined8 uStack_b0;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined4 uStack_58;
undefined2 uStack_48;
undefined2 uStack_46;
undefined4 uStack_44;
undefined *puStack_30;
int iStack_24;
long lStack_20;
int iStack_14;
int iStack_10;
int iStack_c;
for (iStack_c = 0; iStack_c < 1; iStack_c = iStack_c + 1) {
uStack_b8 = 0;
uStack_b0 = 0;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
iStack_14 = 0xffffffff;
iStack_10 = -1;
lStack_20 = func_0x00400c60(&uStack_b8);
iStack_14 = func_0x00400d80(2,1,6);
if (iStack_14 != -1) {
func_0x00400ca0(&uStack_48,0,0x10);
uStack_48 = 2;
uStack_44 = 0;
uStack_46 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_14,5);
if ((((iVar1 != -1) && (iStack_10 = func_0x00400d50(iStack_14,0,0), iStack_10 != -1)) &&
(iVar1 = func_0x00400d40(iStack_14,&uStack_48,0x10), iVar1 != -1)) &&
((iStack_24 = func_0x00400c30(iStack_10,(long)&uStack_b8 + lStack_20,
(long)(99 - (int)lStack_20),0), iStack_24 != -1 &&
(iStack_24 != 0)))) {
*(undefined *)((long)&uStack_b8 + (long)iStack_24) = 0;
puStack_30 = (undefined *)func_0x00400c80(&uStack_b8,0xd);
if (puStack_30 != (undefined *)0x0) {
*puStack_30 = 0;
}
puStack_30 = (undefined *)func_0x00400c80(&uStack_b8,10);
if (puStack_30 != (undefined *)0x0) {
*puStack_30 = 0;
}
}
}
if (iStack_14 != -1) {
func_0x00400cb0(iStack_14);
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
printLine(&uStack_b8);
}
return;
}
| ['gcc'] |
6,968 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_17_good()
{
good1();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110015/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_17.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_17_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_17_good(void)
{
good1();
return;
}
| ['gcc'] |
6,969 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_18_bad()
{
goto sink;
sink:
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), accept(), then bind() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
} | ['/* FLAW: Attempt to listen(), accept(), then bind() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110016/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_18.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_18_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_18_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_10,5);
if ((((iVar1 != -1) && (iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
(iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10), iVar1 != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
return;
}
| ['gcc'] |
6,970 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_18_good()
{
good1();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110016/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_18.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_18_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_accept_bind_18_good(void)
{
good1();
return;
}
| ['gcc'] |
6,971 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_01_bad()
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), bind(), then accept() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
} | ['/* FLAW: Attempt to listen(), bind(), then accept() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110017/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_01.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_01_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_01_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_10,5);
if ((((iVar1 != -1) && (iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10), iVar1 != -1)) &&
(iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
return;
}
| ['gcc'] |
6,972 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_01_good()
{
good1();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110017/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_01.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_01_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_01_good(void)
{
good1();
return;
}
| ['gcc'] |
6,973 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_02_bad()
{
if(1)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), bind(), then accept() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to listen(), bind(), then accept() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110018/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_02.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_02_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_02_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_10,5);
if ((((iVar1 != -1) && (iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10), iVar1 != -1)) &&
(iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
return;
}
| ['gcc'] |
6,974 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_02_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110018/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_02.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_02_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_02_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,975 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_03_bad()
{
if(5==5)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), bind(), then accept() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to listen(), bind(), then accept() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110019/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_03.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_03_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_03_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_10,5);
if ((((iVar1 != -1) && (iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10), iVar1 != -1)) &&
(iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
return;
}
| ['gcc'] |
6,976 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_03_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110019/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_03.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_03_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_03_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,977 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_14_bad()
{
if(globalFive==5)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), bind(), then accept() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to listen(), bind(), then accept() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110030/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_14.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_14_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_14_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
if (globalFive == 5) {
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_10,5);
if ((((iVar1 != -1) && (iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10), iVar1 != -1)) &&
(iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
}
return;
}
| ['gcc'] |
6,978 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_14_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110030/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_14.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_14_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_14_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,979 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_15_bad()
{
switch(6)
{
case 6:
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), bind(), then accept() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
} | ['/* FLAW: Attempt to listen(), bind(), then accept() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */', '/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110031/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_15.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_15_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_15_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_10,5);
if ((((iVar1 != -1) && (iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10), iVar1 != -1)) &&
(iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
return;
}
| ['gcc'] |
6,980 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_15_good()
{
good1();
good2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110031/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_15.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_15_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_15_good(void)
{
good1();
good2();
return;
}
| ['gcc'] |
6,981 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_16_bad()
{
while(1)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), bind(), then accept() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
break;
}
} | ['/* FLAW: Attempt to listen(), bind(), then accept() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110032/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_16.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_16_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_16_bad(void)
{
int iVar1;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined8 uStack_58;
undefined8 uStack_50;
undefined4 uStack_48;
undefined2 uStack_38;
undefined2 uStack_36;
undefined4 uStack_34;
undefined *puStack_28;
int iStack_1c;
long lStack_18;
int iStack_10;
int iStack_c;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
uStack_50 = 0;
uStack_48 = 0;
iStack_10 = 0xffffffff;
iStack_c = -1;
lStack_18 = func_0x00400c60(&uStack_a8);
iStack_10 = func_0x00400d80(2,1,6);
if (iStack_10 != -1) {
func_0x00400ca0(&uStack_38,0,0x10);
uStack_38 = 2;
uStack_34 = 0;
uStack_36 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_10,5);
if ((((iVar1 != -1) && (iVar1 = func_0x00400d40(iStack_10,&uStack_38,0x10), iVar1 != -1)) &&
(iStack_c = func_0x00400d50(iStack_10,0,0), iStack_c != -1)) &&
((iStack_1c = func_0x00400c30(iStack_c,(long)&uStack_a8 + lStack_18,
(long)(99 - (int)lStack_18),0), iStack_1c != -1 &&
(iStack_1c != 0)))) {
*(undefined *)((long)&uStack_a8 + (long)iStack_1c) = 0;
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,0xd);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
puStack_28 = (undefined *)func_0x00400c80(&uStack_a8,10);
if (puStack_28 != (undefined *)0x0) {
*puStack_28 = 0;
}
}
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
if (iStack_c != -1) {
func_0x00400cb0(iStack_c);
}
printLine(&uStack_a8);
return;
}
| ['gcc'] |
6,982 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_16_good()
{
good1();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110032/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_16.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_16_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_16_good(void)
{
good1();
return;
}
| ['gcc'] |
6,983 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_17_bad()
{
int j;
for(j = 0; j < 1; j++)
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = strlen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
/* FLAW: Attempt to listen(), bind(), then accept() */
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)data+dataLen, (int)(100-dataLen-1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[recvResult] = '\0';
/* Eliminate CRLF */
replace = strchr(data, '\r');
if (replace)
{
*replace = '\0';
}
replace = strchr(data, '\n');
if (replace)
{
*replace = '\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
printLine(data);
}
}
} | ['/* FLAW: Attempt to listen(), bind(), then accept() */', '/* Abort on error or the connection was closed */', '/* Append null terminator */', '/* Eliminate CRLF */'] | ['CWE666'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110033/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_17.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_17_bad |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_17_bad(void)
{
int iVar1;
undefined8 uStack_b8;
undefined8 uStack_b0;
undefined8 uStack_a8;
undefined8 uStack_a0;
undefined8 uStack_98;
undefined8 uStack_90;
undefined8 uStack_88;
undefined8 uStack_80;
undefined8 uStack_78;
undefined8 uStack_70;
undefined8 uStack_68;
undefined8 uStack_60;
undefined4 uStack_58;
undefined2 uStack_48;
undefined2 uStack_46;
undefined4 uStack_44;
undefined *puStack_30;
int iStack_24;
long lStack_20;
int iStack_14;
int iStack_10;
int iStack_c;
for (iStack_c = 0; iStack_c < 1; iStack_c = iStack_c + 1) {
uStack_b8 = 0;
uStack_b0 = 0;
uStack_a8 = 0;
uStack_a0 = 0;
uStack_98 = 0;
uStack_90 = 0;
uStack_88 = 0;
uStack_80 = 0;
uStack_78 = 0;
uStack_70 = 0;
uStack_68 = 0;
uStack_60 = 0;
uStack_58 = 0;
iStack_14 = 0xffffffff;
iStack_10 = -1;
lStack_20 = func_0x00400c60(&uStack_b8);
iStack_14 = func_0x00400d80(2,1,6);
if (iStack_14 != -1) {
func_0x00400ca0(&uStack_48,0,0x10);
uStack_48 = 2;
uStack_44 = 0;
uStack_46 = func_0x00400c70(0x6987);
iVar1 = func_0x00400d30(iStack_14,5);
if ((((iVar1 != -1) && (iVar1 = func_0x00400d40(iStack_14,&uStack_48,0x10), iVar1 != -1)) &&
(iStack_10 = func_0x00400d50(iStack_14,0,0), iStack_10 != -1)) &&
((iStack_24 = func_0x00400c30(iStack_10,(long)&uStack_b8 + lStack_20,
(long)(99 - (int)lStack_20),0), iStack_24 != -1 &&
(iStack_24 != 0)))) {
*(undefined *)((long)&uStack_b8 + (long)iStack_24) = 0;
puStack_30 = (undefined *)func_0x00400c80(&uStack_b8,0xd);
if (puStack_30 != (undefined *)0x0) {
*puStack_30 = 0;
}
puStack_30 = (undefined *)func_0x00400c80(&uStack_b8,10);
if (puStack_30 != (undefined *)0x0) {
*puStack_30 = 0;
}
}
}
if (iStack_14 != -1) {
func_0x00400cb0(iStack_14);
}
if (iStack_10 != -1) {
func_0x00400cb0(iStack_10);
}
printLine(&uStack_b8);
}
return;
}
| ['gcc'] |
6,984 | void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_17_good()
{
good1();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110033/CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_17.c | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_17_good |
void CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__listen_bind_accept_17_good(void)
{
good1();
return;
}
| ['gcc'] |
6,985 | void CWE675_Duplicate_Operations_on_Resource__fopen_08_bad()
{
FILE * data;
data = NULL; /* Initialize data */
if(staticReturnsTrue())
{
data = fopen("BadSource_fopen.txt", "w+");
/* POTENTIAL FLAW: Close the file in the source */
fclose(data);
}
if(staticReturnsTrue())
{
/* POTENTIAL FLAW: Close the file in the sink (it may have been closed in the Source) */
fclose(data);
}
} | ['/* Initialize data */', '/* POTENTIAL FLAW: Close the file in the source */', '/* POTENTIAL FLAW: Close the file in the sink (it may have been closed in the Source) */'] | ['CWE675'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110109/CWE675_Duplicate_Operations_on_Resource__fopen_08.c | CWE675_Duplicate_Operations_on_Resource__fopen_08_bad |
void CWE675_Duplicate_Operations_on_Resource__fopen_08_bad(void)
{
int iVar1;
undefined8 uStack_10;
uStack_10 = 0;
iVar1 = staticReturnsTrue();
if (iVar1 != 0) {
uStack_10 = func_0x00400ad0(&UNK_004011c7,&UNK_004011c4);
func_0x00400a40(uStack_10);
}
iVar1 = staticReturnsTrue();
if (iVar1 != 0) {
func_0x00400a40(uStack_10);
}
return;
}
| ['gcc'] |
6,986 | void CWE675_Duplicate_Operations_on_Resource__fopen_08_good()
{
goodB2G1();
goodB2G2();
goodG2B1();
goodG2B2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110109/CWE675_Duplicate_Operations_on_Resource__fopen_08.c | CWE675_Duplicate_Operations_on_Resource__fopen_08_good |
void CWE675_Duplicate_Operations_on_Resource__fopen_08_good(void)
{
goodB2G1();
goodB2G2();
goodG2B1();
goodG2B2();
return;
}
| ['gcc'] |
6,987 | void CWE675_Duplicate_Operations_on_Resource__fopen_11_bad()
{
FILE * data;
data = NULL; /* Initialize data */
if(globalReturnsTrue())
{
data = fopen("BadSource_fopen.txt", "w+");
/* POTENTIAL FLAW: Close the file in the source */
fclose(data);
}
if(globalReturnsTrue())
{
/* POTENTIAL FLAW: Close the file in the sink (it may have been closed in the Source) */
fclose(data);
}
} | ['/* Initialize data */', '/* POTENTIAL FLAW: Close the file in the source */', '/* POTENTIAL FLAW: Close the file in the sink (it may have been closed in the Source) */'] | ['CWE675'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110112/CWE675_Duplicate_Operations_on_Resource__fopen_11.c | CWE675_Duplicate_Operations_on_Resource__fopen_11_bad |
void CWE675_Duplicate_Operations_on_Resource__fopen_11_bad(void)
{
int iVar1;
undefined8 uStack_10;
uStack_10 = 0;
iVar1 = globalReturnsTrue();
if (iVar1 != 0) {
uStack_10 = func_0x00400ad0(&UNK_004011a7,&UNK_004011a4);
func_0x00400a40(uStack_10);
}
iVar1 = globalReturnsTrue();
if (iVar1 != 0) {
func_0x00400a40(uStack_10);
}
return;
}
| ['gcc'] |
6,988 | void CWE675_Duplicate_Operations_on_Resource__fopen_11_good()
{
goodB2G1();
goodB2G2();
goodG2B1();
goodG2B2();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110112/CWE675_Duplicate_Operations_on_Resource__fopen_11.c | CWE675_Duplicate_Operations_on_Resource__fopen_11_good |
void CWE675_Duplicate_Operations_on_Resource__fopen_11_good(void)
{
goodB2G1();
goodB2G2();
goodG2B1();
goodG2B2();
return;
}
| ['gcc'] |
6,989 | void CWE675_Duplicate_Operations_on_Resource__fopen_12_bad()
{
FILE * data;
data = NULL; /* Initialize data */
if(globalReturnsTrueOrFalse())
{
data = fopen("BadSource_fopen.txt", "w+");
/* POTENTIAL FLAW: Close the file in the source */
fclose(data);
}
else
{
/* FIX: Open, but do not close the file in the source */
data = fopen("GoodSource_fopen.txt", "w+");
}
if(globalReturnsTrueOrFalse())
{
/* POTENTIAL FLAW: Close the file in the sink (it may have been closed in the Source) */
fclose(data);
}
else
{
/* Do nothing */
/* FIX: Don't close the file in the sink */
; /* empty statement needed for some flow variants */
}
} | ['/* Initialize data */', '/* POTENTIAL FLAW: Close the file in the source */', '/* FIX: Open, but do not close the file in the source */', '/* POTENTIAL FLAW: Close the file in the sink (it may have been closed in the Source) */', '/* Do nothing */', "/* FIX: Don't close the file in the sink */", '/* empty statement needed for some flow variants */'] | ['CWE675'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110113/CWE675_Duplicate_Operations_on_Resource__fopen_12.c | CWE675_Duplicate_Operations_on_Resource__fopen_12_bad |
void CWE675_Duplicate_Operations_on_Resource__fopen_12_bad(void)
{
int iVar1;
undefined8 uStack_10;
iVar1 = globalReturnsTrueOrFalse();
if (iVar1 == 0) {
uStack_10 = func_0x00400ad0(&UNK_004011db,&UNK_004011c4);
}
else {
uStack_10 = func_0x00400ad0(&UNK_004011c7,&UNK_004011c4);
func_0x00400a40(uStack_10);
}
iVar1 = globalReturnsTrueOrFalse();
if (iVar1 != 0) {
func_0x00400a40(uStack_10);
}
return;
}
| ['gcc'] |
6,990 | void CWE675_Duplicate_Operations_on_Resource__fopen_12_good()
{
goodB2G();
goodG2B();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110113/CWE675_Duplicate_Operations_on_Resource__fopen_12.c | CWE675_Duplicate_Operations_on_Resource__fopen_12_good |
void CWE675_Duplicate_Operations_on_Resource__fopen_12_good(void)
{
goodB2G();
goodG2B();
return;
}
| ['gcc'] |
6,991 | void CWE675_Duplicate_Operations_on_Resource__fopen_53_bad()
{
FILE * data;
data = NULL; /* Initialize data */
data = fopen("BadSource_fopen.txt", "w+");
/* POTENTIAL FLAW: Close the file in the source */
fclose(data);
CWE675_Duplicate_Operations_on_Resource__fopen_53b_badSink(data);
} | ['/* Initialize data */', '/* POTENTIAL FLAW: Close the file in the source */'] | ['CWE675'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110133/CWE675_Duplicate_Operations_on_Resource__fopen_53a.c | CWE675_Duplicate_Operations_on_Resource__fopen_53_bad |
void CWE675_Duplicate_Operations_on_Resource__fopen_53_bad(void)
{
undefined8 uVar1;
uVar1 = func_0x00400ad0(&UNK_004011e7,&UNK_004011e4);
func_0x00400a40(uVar1);
CWE675_Duplicate_Operations_on_Resource__fopen_53b_badSink(uVar1);
return;
}
| ['gcc'] |
6,992 | void CWE675_Duplicate_Operations_on_Resource__fopen_53_good()
{
goodG2B();
goodB2G();
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110133/CWE675_Duplicate_Operations_on_Resource__fopen_53a.c | CWE675_Duplicate_Operations_on_Resource__fopen_53_good |
void CWE675_Duplicate_Operations_on_Resource__fopen_53_good(void)
{
goodG2B();
goodB2G();
return;
}
| ['gcc'] |
6,993 | void CWE675_Duplicate_Operations_on_Resource__fopen_53b_badSink(FILE * data)
{
CWE675_Duplicate_Operations_on_Resource__fopen_53c_badSink(data);
} | [] | ['CWE675'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110133/CWE675_Duplicate_Operations_on_Resource__fopen_53b.c | CWE675_Duplicate_Operations_on_Resource__fopen_53b_badSink |
void CWE675_Duplicate_Operations_on_Resource__fopen_53b_badSink(undefined8 param_1)
{
CWE675_Duplicate_Operations_on_Resource__fopen_53c_badSink(param_1);
return;
}
| ['gcc'] |
6,994 | void CWE675_Duplicate_Operations_on_Resource__fopen_53b_goodG2BSink(FILE * data)
{
CWE675_Duplicate_Operations_on_Resource__fopen_53c_goodG2BSink(data);
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110133/CWE675_Duplicate_Operations_on_Resource__fopen_53b.c | CWE675_Duplicate_Operations_on_Resource__fopen_53b_goodG2BSink |
void CWE675_Duplicate_Operations_on_Resource__fopen_53b_goodG2BSink(undefined8 param_1)
{
CWE675_Duplicate_Operations_on_Resource__fopen_53c_goodG2BSink(param_1);
return;
}
| ['gcc'] |
6,995 | void CWE675_Duplicate_Operations_on_Resource__fopen_53b_goodB2GSink(FILE * data)
{
CWE675_Duplicate_Operations_on_Resource__fopen_53c_goodB2GSink(data);
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110133/CWE675_Duplicate_Operations_on_Resource__fopen_53b.c | CWE675_Duplicate_Operations_on_Resource__fopen_53b_goodB2GSink |
void CWE675_Duplicate_Operations_on_Resource__fopen_53b_goodB2GSink(undefined8 param_1)
{
CWE675_Duplicate_Operations_on_Resource__fopen_53c_goodB2GSink(param_1);
return;
}
| ['gcc'] |
6,996 | void CWE675_Duplicate_Operations_on_Resource__fopen_53c_badSink(FILE * data)
{
CWE675_Duplicate_Operations_on_Resource__fopen_53d_badSink(data);
} | [] | ['CWE675'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110133/CWE675_Duplicate_Operations_on_Resource__fopen_53c.c | CWE675_Duplicate_Operations_on_Resource__fopen_53c_badSink |
void CWE675_Duplicate_Operations_on_Resource__fopen_53c_badSink(undefined8 param_1)
{
CWE675_Duplicate_Operations_on_Resource__fopen_53d_badSink(param_1);
return;
}
| ['gcc'] |
6,997 | void CWE675_Duplicate_Operations_on_Resource__fopen_53c_goodG2BSink(FILE * data)
{
CWE675_Duplicate_Operations_on_Resource__fopen_53d_goodG2BSink(data);
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110133/CWE675_Duplicate_Operations_on_Resource__fopen_53c.c | CWE675_Duplicate_Operations_on_Resource__fopen_53c_goodG2BSink |
void CWE675_Duplicate_Operations_on_Resource__fopen_53c_goodG2BSink(undefined8 param_1)
{
CWE675_Duplicate_Operations_on_Resource__fopen_53d_goodG2BSink(param_1);
return;
}
| ['gcc'] |
6,998 | void CWE675_Duplicate_Operations_on_Resource__fopen_53c_goodB2GSink(FILE * data)
{
CWE675_Duplicate_Operations_on_Resource__fopen_53d_goodB2GSink(data);
} | [] | null | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110133/CWE675_Duplicate_Operations_on_Resource__fopen_53c.c | CWE675_Duplicate_Operations_on_Resource__fopen_53c_goodB2GSink |
void CWE675_Duplicate_Operations_on_Resource__fopen_53c_goodB2GSink(undefined8 param_1)
{
CWE675_Duplicate_Operations_on_Resource__fopen_53d_goodB2GSink(param_1);
return;
}
| ['gcc'] |
6,999 | void CWE675_Duplicate_Operations_on_Resource__fopen_53d_badSink(FILE * data)
{
/* POTENTIAL FLAW: Close the file in the sink (it may have been closed in the Source) */
fclose(data);
} | ['/* POTENTIAL FLAW: Close the file in the sink (it may have been closed in the Source) */'] | ['CWE675'] | mvd | /work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/110133/CWE675_Duplicate_Operations_on_Resource__fopen_53d.c | CWE675_Duplicate_Operations_on_Resource__fopen_53d_badSink |
void CWE675_Duplicate_Operations_on_Resource__fopen_53d_badSink(undefined8 param_1)
{
func_0x00400a40(param_1);
return;
}
| ['gcc'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.