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
48,000
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_21_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86880/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_21.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_21_good
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_21_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
48,001
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_bad() { short data; /* Initialize data */ data = 0; CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_badGlobal = 1; /* true */ data = CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_badSource(data); /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* true */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86881/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_bad(void) { short sVar1; long lVar2; CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_badGlobal = 1; sVar1 = CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_badSource(0); if (sVar1 < 100) { lVar2 = func_0x00400d40((long)sVar1); func_0x00400cd0(lVar2,0x41,(long)(sVar1 + -1)); *(undefined *)(lVar2 + (long)sVar1 + -1) = 0; printLine(lVar2); func_0x00400c70(lVar2); } return; }
['gcc']
48,002
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86881/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_good
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
48,003
short CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_badSource(short data) { if(CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_badGlobal) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } return data; }
['/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86881/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_badSource
undefined2 CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_badSource(undefined2 param_1) { int iVar1; undefined2 uStack_3c; undefined auStack_30 [8]; undefined2 uStack_28; undefined2 uStack_26; undefined4 uStack_24; int iStack_18; int iStack_14; int iStack_10; int iStack_c; uStack_3c = param_1; if (CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_badGlobal != 0) { iStack_10 = 0xffffffff; iStack_c = -1; iStack_10 = func_0x00400dd0(2,1,6); if (iStack_10 != -1) { func_0x00400cd0(&uStack_28,0,0x10); uStack_28 = 2; uStack_24 = 0; uStack_26 = func_0x00400cb0(0x6987); iVar1 = func_0x00400d80(iStack_10,&uStack_28,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d70(iStack_10,5), iVar1 != -1)) && (iStack_c = func_0x00400d90(iStack_10,0,0), iStack_c != -1)) && ((iStack_14 = func_0x00400c80(iStack_c,auStack_30,7,0), iStack_14 != -1 && (iStack_14 != 0) ))) { auStack_30[iStack_14] = 0; iStack_18 = func_0x00400da0(auStack_30); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { uStack_3c = (undefined2)iStack_18; } else { uStack_3c = 0xffff; } } } if (iStack_10 != -1) { func_0x00400ce0(iStack_10); } if (iStack_c != -1) { func_0x00400ce0(iStack_c); } } return uStack_3c; }
['gcc']
48,004
short CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_goodG2B1Source(short data) { if(CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_goodG2B1Global) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Use a positive integer less than &InitialDataSize&*/ data = 100-1; } return data; }
['/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */', '/* FIX: Use a positive integer less than &InitialDataSize&*/']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86881/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_goodG2B1Source
undefined2 CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_goodG2B1Source(undefined2 param_1) { undefined2 uStack_c; if (CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_goodG2B1Global == 0) { uStack_c = 99; } else { printLine(&UNK_00401314); uStack_c = param_1; } return uStack_c; }
['gcc']
48,005
short CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_goodG2B2Source(short data) { if(CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_goodG2B2Global) { /* FIX: Use a positive integer less than &InitialDataSize&*/ data = 100-1; } return data; }
['/* FIX: Use a positive integer less than &InitialDataSize&*/']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86881/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_goodG2B2Source
undefined2 CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_goodG2B2Source(undefined2 param_1) { undefined2 uStack_c; uStack_c = param_1; if (CWE194_Unexpected_Sign_Extension__listen_socket_malloc_22_goodG2B2Global != 0) { uStack_c = 99; } return uStack_c; }
['gcc']
48,006
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_31_bad() { short data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } { short dataCopy = data; short data = dataCopy; /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } } }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86882/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_31.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_31_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_31_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; long lStack_28; short sStack_20; short sStack_1e; int iStack_1c; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400dd0(2,1,6); if (iStack_14 != -1) { func_0x00400cd0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400cb0(0x6987); iVar1 = func_0x00400d80(iStack_14,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d70(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d90(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c80(iStack_10,auStack_40,7,0), iStack_18 != -1 && (iStack_18 != 0)) )) { auStack_40[iStack_18] = 0; iStack_1c = func_0x00400da0(auStack_40); if ((iStack_1c < 0x8000) && (-0x8001 < iStack_1c)) { sStack_a = (short)iStack_1c; } else { sStack_a = -1; } } } if (iStack_14 != -1) { func_0x00400ce0(iStack_14); } if (iStack_10 != -1) { func_0x00400ce0(iStack_10); } sStack_1e = sStack_a; sStack_20 = sStack_a; if (sStack_a < 100) { lStack_28 = func_0x00400d40((long)sStack_a); func_0x00400cd0(lStack_28,0x41,(long)(sStack_20 + -1)); *(undefined *)(lStack_28 + (long)sStack_20 + -1) = 0; printLine(lStack_28); func_0x00400c70(lStack_28); } return; }
['gcc']
48,007
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_31_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86882/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_31.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_31_good
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_31_good(void) { goodG2B(); return; }
['gcc']
48,008
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_32_bad() { short data; short *dataPtr1 = &data; short *dataPtr2 = &data; /* Initialize data */ data = 0; { short data = *dataPtr1; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } *dataPtr1 = data; } { short data = *dataPtr2; /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } } }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86883/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_32.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_32_bad
/* WARNING: Restarted to delay deadcode elimination for space: stack */ void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_32_bad(void) { int iVar1; undefined auStack_60 [8]; undefined2 uStack_58; undefined2 uStack_56; undefined4 uStack_54; short sStack_3a; long lStack_38; short sStack_2e; int iStack_2c; int iStack_28; int iStack_24; short *psStack_20; short *psStack_18; int iStack_10; short sStack_a; psStack_18 = &sStack_3a; psStack_20 = &sStack_3a; sStack_3a = 0; sStack_a = 0; iStack_24 = 0xffffffff; iStack_10 = -1; iStack_24 = func_0x00400dd0(2,1,6); if (iStack_24 != -1) { func_0x00400cd0(&uStack_58,0,0x10); uStack_58 = 2; uStack_54 = 0; uStack_56 = func_0x00400cb0(0x6987); iVar1 = func_0x00400d80(iStack_24,&uStack_58,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d70(iStack_24,5), iVar1 != -1)) && (iStack_10 = func_0x00400d90(iStack_24,0,0), iStack_10 != -1)) && ((iStack_28 = func_0x00400c80(iStack_10,auStack_60,7,0), iStack_28 != -1 && (iStack_28 != 0)) )) { auStack_60[iStack_28] = 0; iStack_2c = func_0x00400da0(auStack_60); if ((iStack_2c < 0x8000) && (-0x8001 < iStack_2c)) { sStack_a = (short)iStack_2c; } else { sStack_a = -1; } } } if (iStack_24 != -1) { func_0x00400ce0(iStack_24); } if (iStack_10 != -1) { func_0x00400ce0(iStack_10); } *psStack_18 = sStack_a; sStack_2e = *psStack_20; if (sStack_2e < 100) { lStack_38 = func_0x00400d40((long)sStack_2e); func_0x00400cd0(lStack_38,0x41,(long)(sStack_2e + -1)); *(undefined *)(lStack_38 + (long)sStack_2e + -1) = 0; printLine(lStack_38); func_0x00400c70(lStack_38); } return; }
['gcc']
48,009
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_32_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86883/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_32.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_32_good
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_32_good(void) { goodG2B(); return; }
['gcc']
48,010
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_34_bad() { short data; CWE194_Unexpected_Sign_Extension__listen_socket_malloc_34_unionType myUnion; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } myUnion.unionFirst = data; { short data = myUnion.unionSecond; /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } } }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86885/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_34.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_34_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_34_bad(void) { int iVar1; undefined auStack_50 [8]; undefined2 uStack_48; undefined2 uStack_46; undefined4 uStack_44; short sStack_2a; long lStack_28; short sStack_1e; int iStack_1c; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400dd0(2,1,6); if (iStack_14 != -1) { func_0x00400cd0(&uStack_48,0,0x10); uStack_48 = 2; uStack_44 = 0; uStack_46 = func_0x00400cb0(0x6987); iVar1 = func_0x00400d80(iStack_14,&uStack_48,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d70(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d90(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c80(iStack_10,auStack_50,7,0), iStack_18 != -1 && (iStack_18 != 0)) )) { auStack_50[iStack_18] = 0; iStack_1c = func_0x00400da0(auStack_50); if ((iStack_1c < 0x8000) && (-0x8001 < iStack_1c)) { sStack_a = (short)iStack_1c; } else { sStack_a = -1; } } } if (iStack_14 != -1) { func_0x00400ce0(iStack_14); } if (iStack_10 != -1) { func_0x00400ce0(iStack_10); } sStack_2a = sStack_a; sStack_1e = sStack_a; if (sStack_a < 100) { lStack_28 = func_0x00400d40((long)sStack_a); func_0x00400cd0(lStack_28,0x41,(long)(sStack_1e + -1)); *(undefined *)(lStack_28 + (long)sStack_1e + -1) = 0; printLine(lStack_28); func_0x00400c70(lStack_28); } return; }
['gcc']
48,011
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_34_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86885/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_34.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_34_good
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_34_good(void) { goodG2B(); return; }
['gcc']
48,012
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_41_badSink(short data) { /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86886/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_41.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_41_badSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_41_badSink(short param_1) { long lVar1; if (param_1 < 100) { lVar1 = func_0x00400d40((long)param_1); func_0x00400cd0(lVar1,0x41,(long)(param_1 + -1)); *(undefined *)(lVar1 + (long)param_1 + -1) = 0; printLine(lVar1); func_0x00400c70(lVar1); } return; }
['gcc']
48,013
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_41_bad() { short data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } CWE194_Unexpected_Sign_Extension__listen_socket_malloc_41_badSink(data); }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86886/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_41.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_41_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_41_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400dd0(2,1,6); if (iStack_14 != -1) { func_0x00400cd0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400cb0(0x6987); iVar1 = func_0x00400d80(iStack_14,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d70(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d90(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c80(iStack_10,auStack_40,7,0), iStack_18 != -1 && (iStack_18 != 0)) )) { auStack_40[iStack_18] = 0; iStack_1c = func_0x00400da0(auStack_40); if ((iStack_1c < 0x8000) && (-0x8001 < iStack_1c)) { sStack_a = (short)iStack_1c; } else { sStack_a = -1; } } } if (iStack_14 != -1) { func_0x00400ce0(iStack_14); } if (iStack_10 != -1) { func_0x00400ce0(iStack_10); } CWE194_Unexpected_Sign_Extension__listen_socket_malloc_41_badSink((int)sStack_a); return; }
['gcc']
48,014
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_41_goodG2BSink(short data) { /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86886/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_41.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_41_goodG2BSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_41_goodG2BSink(short param_1) { long lVar1; if (param_1 < 100) { lVar1 = func_0x00400b00((long)param_1); func_0x00400aa0(lVar1,0x41,(long)(param_1 + -1)); *(undefined *)(lVar1 + (long)param_1 + -1) = 0; printLine(lVar1); func_0x00400a60(lVar1); } return; }
['gcc']
48,015
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_41_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86886/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_41.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_41_good
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_41_good(void) { goodG2B(); return; }
['gcc']
48,016
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_42_bad() { short data; /* Initialize data */ data = 0; data = badSource(data); /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86887/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_42.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_42_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_42_bad(void) { short sVar1; long lVar2; sVar1 = badSource(0); if (sVar1 < 100) { lVar2 = func_0x00400d40((long)sVar1); func_0x00400cd0(lVar2,0x41,(long)(sVar1 + -1)); *(undefined *)(lVar2 + (long)sVar1 + -1) = 0; printLine(lVar2); func_0x00400c70(lVar2); } return; }
['gcc']
48,017
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_42_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86887/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_42.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_42_good
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_42_good(void) { goodG2B(); return; }
['gcc']
48,018
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_44_bad() { short data; /* define a function pointer */ void (*funcPtr) (short) = badSink; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } /* use the function pointer */ funcPtr(data); }
['/* define a function pointer */', '/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* use the function pointer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86889/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_44.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_44_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_44_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_24; int iStack_20; int iStack_1c; code *pcStack_18; int iStack_10; short sStack_a; pcStack_18 = badSink; sStack_a = 0; iStack_1c = 0xffffffff; iStack_10 = -1; iStack_1c = func_0x00400dd0(2,1,6); if (iStack_1c != -1) { func_0x00400cd0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400cb0(0x6987); iVar1 = func_0x00400d80(iStack_1c,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d70(iStack_1c,5), iVar1 != -1)) && (iStack_10 = func_0x00400d90(iStack_1c,0,0), iStack_10 != -1)) && ((iStack_20 = func_0x00400c80(iStack_10,auStack_40,7,0), iStack_20 != -1 && (iStack_20 != 0)) )) { auStack_40[iStack_20] = 0; iStack_24 = func_0x00400da0(auStack_40); if ((iStack_24 < 0x8000) && (-0x8001 < iStack_24)) { sStack_a = (short)iStack_24; } else { sStack_a = -1; } } } if (iStack_1c != -1) { func_0x00400ce0(iStack_1c); } if (iStack_10 != -1) { func_0x00400ce0(iStack_10); } (*pcStack_18)((int)sStack_a); return; }
['gcc']
48,019
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_44_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86889/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_44.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_44_good
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_44_good(void) { goodG2B(); return; }
['gcc']
48,020
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_45_bad() { short data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } CWE194_Unexpected_Sign_Extension__listen_socket_malloc_45_badData = data; badSink(); }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86890/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_45.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_45_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_45_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; int iStack_10; undefined2 uStack_a; uStack_a = 0; iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400dd0(2,1,6); if (iStack_14 != -1) { func_0x00400cd0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400cb0(0x6987); iVar1 = func_0x00400d80(iStack_14,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d70(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d90(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c80(iStack_10,auStack_40,7,0), iStack_18 != -1 && (iStack_18 != 0)) )) { auStack_40[iStack_18] = 0; iStack_1c = func_0x00400da0(auStack_40); if ((iStack_1c < 0x8000) && (-0x8001 < iStack_1c)) { uStack_a = (undefined2)iStack_1c; } else { uStack_a = 0xffff; } } } if (iStack_14 != -1) { func_0x00400ce0(iStack_14); } if (iStack_10 != -1) { func_0x00400ce0(iStack_10); } CWE194_Unexpected_Sign_Extension__listen_socket_malloc_45_badData = uStack_a; badSink(); return; }
['gcc']
48,021
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_45_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86890/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_45.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_45_good
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_45_good(void) { goodG2B(); return; }
['gcc']
48,022
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_51_bad() { short data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } CWE194_Unexpected_Sign_Extension__listen_socket_malloc_51b_badSink(data); }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86891/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_51a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_51_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_51_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400dd0(2,1,6); if (iStack_14 != -1) { func_0x00400cd0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400cb0(0x6987); iVar1 = func_0x00400d80(iStack_14,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d70(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d90(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c80(iStack_10,auStack_40,7,0), iStack_18 != -1 && (iStack_18 != 0)) )) { auStack_40[iStack_18] = 0; iStack_1c = func_0x00400da0(auStack_40); if ((iStack_1c < 0x8000) && (-0x8001 < iStack_1c)) { sStack_a = (short)iStack_1c; } else { sStack_a = -1; } } } if (iStack_14 != -1) { func_0x00400ce0(iStack_14); } if (iStack_10 != -1) { func_0x00400ce0(iStack_10); } CWE194_Unexpected_Sign_Extension__listen_socket_malloc_51b_badSink((int)sStack_a); return; }
['gcc']
48,023
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_51_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86891/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_51a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_51_good
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_51_good(void) { goodG2B(); return; }
['gcc']
48,024
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_51b_badSink(short data) { /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86891/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_51b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_51b_badSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_51b_badSink(short param_1) { long lVar1; if (param_1 < 100) { lVar1 = func_0x00400d40((long)param_1); func_0x00400cd0(lVar1,0x41,(long)(param_1 + -1)); *(undefined *)(lVar1 + (long)param_1 + -1) = 0; printLine(lVar1); func_0x00400c70(lVar1); } return; }
['gcc']
48,025
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_51b_goodG2BSink(short data) { /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86891/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_51b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_51b_goodG2BSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_51b_goodG2BSink(short param_1) { long lVar1; if (param_1 < 100) { lVar1 = func_0x00400b00((long)param_1); func_0x00400aa0(lVar1,0x41,(long)(param_1 + -1)); *(undefined *)(lVar1 + (long)param_1 + -1) = 0; printLine(lVar1); func_0x00400a60(lVar1); } return; }
['gcc']
48,026
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52_bad() { short data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52b_badSink(data); }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86892/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400dd0(2,1,6); if (iStack_14 != -1) { func_0x00400cd0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400cb0(0x6987); iVar1 = func_0x00400d80(iStack_14,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d70(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d90(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c80(iStack_10,auStack_40,7,0), iStack_18 != -1 && (iStack_18 != 0)) )) { auStack_40[iStack_18] = 0; iStack_1c = func_0x00400da0(auStack_40); if ((iStack_1c < 0x8000) && (-0x8001 < iStack_1c)) { sStack_a = (short)iStack_1c; } else { sStack_a = -1; } } } if (iStack_14 != -1) { func_0x00400ce0(iStack_14); } if (iStack_10 != -1) { func_0x00400ce0(iStack_10); } CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52b_badSink((int)sStack_a); return; }
['gcc']
48,027
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86892/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52_good
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52_good(void) { goodG2B(); return; }
['gcc']
48,028
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52b_badSink(short data) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52c_badSink(data); }
[]
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86892/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52b_badSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52b_badSink(short param_1) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52c_badSink((int)param_1); return; }
['gcc']
48,029
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52b_goodG2BSink(short data) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52c_goodG2BSink(data); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86892/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52b_goodG2BSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52b_goodG2BSink(short param_1) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52c_goodG2BSink((int)param_1); return; }
['gcc']
48,030
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52c_badSink(short data) { /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86892/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52c.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52c_badSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52c_badSink(short param_1) { long lVar1; if (param_1 < 100) { lVar1 = func_0x00400d40((long)param_1); func_0x00400cd0(lVar1,0x41,(long)(param_1 + -1)); *(undefined *)(lVar1 + (long)param_1 + -1) = 0; printLine(lVar1); func_0x00400c70(lVar1); } return; }
['gcc']
48,031
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52c_goodG2BSink(short data) { /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86892/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52c.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52c_goodG2BSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_52c_goodG2BSink(short param_1) { long lVar1; if (param_1 < 100) { lVar1 = func_0x00400b00((long)param_1); func_0x00400aa0(lVar1,0x41,(long)(param_1 + -1)); *(undefined *)(lVar1 + (long)param_1 + -1) = 0; printLine(lVar1); func_0x00400a60(lVar1); } return; }
['gcc']
48,032
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53_bad() { short data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53b_badSink(data); }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86893/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400dd0(2,1,6); if (iStack_14 != -1) { func_0x00400cd0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400cb0(0x6987); iVar1 = func_0x00400d80(iStack_14,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d70(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d90(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c80(iStack_10,auStack_40,7,0), iStack_18 != -1 && (iStack_18 != 0)) )) { auStack_40[iStack_18] = 0; iStack_1c = func_0x00400da0(auStack_40); if ((iStack_1c < 0x8000) && (-0x8001 < iStack_1c)) { sStack_a = (short)iStack_1c; } else { sStack_a = -1; } } } if (iStack_14 != -1) { func_0x00400ce0(iStack_14); } if (iStack_10 != -1) { func_0x00400ce0(iStack_10); } CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53b_badSink((int)sStack_a); return; }
['gcc']
48,033
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86893/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53_good
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53_good(void) { goodG2B(); return; }
['gcc']
48,034
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53b_badSink(short data) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53c_badSink(data); }
[]
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86893/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53b_badSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53b_badSink(short param_1) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53c_badSink((int)param_1); return; }
['gcc']
48,035
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53b_goodG2BSink(short data) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53c_goodG2BSink(data); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86893/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53b_goodG2BSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53b_goodG2BSink(short param_1) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53c_goodG2BSink((int)param_1); return; }
['gcc']
48,036
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53c_badSink(short data) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53d_badSink(data); }
[]
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86893/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53c.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53c_badSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53c_badSink(short param_1) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53d_badSink((int)param_1); return; }
['gcc']
48,037
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53c_goodG2BSink(short data) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53d_goodG2BSink(data); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86893/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53c.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53c_goodG2BSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53c_goodG2BSink(short param_1) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53d_goodG2BSink((int)param_1); return; }
['gcc']
48,038
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53d_badSink(short data) { /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86893/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53d.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53d_badSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53d_badSink(short param_1) { long lVar1; if (param_1 < 100) { lVar1 = func_0x00400d40((long)param_1); func_0x00400cd0(lVar1,0x41,(long)(param_1 + -1)); *(undefined *)(lVar1 + (long)param_1 + -1) = 0; printLine(lVar1); func_0x00400c70(lVar1); } return; }
['gcc']
48,039
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53d_goodG2BSink(short data) { /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86893/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53d.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53d_goodG2BSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_53d_goodG2BSink(short param_1) { long lVar1; if (param_1 < 100) { lVar1 = func_0x00400b00((long)param_1); func_0x00400aa0(lVar1,0x41,(long)(param_1 + -1)); *(undefined *)(lVar1 + (long)param_1 + -1) = 0; printLine(lVar1); func_0x00400a60(lVar1); } return; }
['gcc']
48,040
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54_bad() { short data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54b_badSink(data); }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86894/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400dd0(2,1,6); if (iStack_14 != -1) { func_0x00400cd0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400cb0(0x6987); iVar1 = func_0x00400d80(iStack_14,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d70(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d90(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c80(iStack_10,auStack_40,7,0), iStack_18 != -1 && (iStack_18 != 0)) )) { auStack_40[iStack_18] = 0; iStack_1c = func_0x00400da0(auStack_40); if ((iStack_1c < 0x8000) && (-0x8001 < iStack_1c)) { sStack_a = (short)iStack_1c; } else { sStack_a = -1; } } } if (iStack_14 != -1) { func_0x00400ce0(iStack_14); } if (iStack_10 != -1) { func_0x00400ce0(iStack_10); } CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54b_badSink((int)sStack_a); return; }
['gcc']
48,041
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86894/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54_good
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54_good(void) { goodG2B(); return; }
['gcc']
48,042
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54b_badSink(short data) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54c_badSink(data); }
[]
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86894/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54b_badSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54b_badSink(short param_1) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54c_badSink((int)param_1); return; }
['gcc']
48,043
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54b_goodG2BSink(short data) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54c_goodG2BSink(data); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86894/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54b_goodG2BSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54b_goodG2BSink(short param_1) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54c_goodG2BSink((int)param_1); return; }
['gcc']
48,044
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54c_badSink(short data) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54d_badSink(data); }
[]
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86894/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54c.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54c_badSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54c_badSink(short param_1) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54d_badSink((int)param_1); return; }
['gcc']
48,045
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54c_goodG2BSink(short data) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54d_goodG2BSink(data); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86894/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54c.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54c_goodG2BSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54c_goodG2BSink(short param_1) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54d_goodG2BSink((int)param_1); return; }
['gcc']
48,046
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54d_badSink(short data) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54e_badSink(data); }
[]
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86894/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54d.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54d_badSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54d_badSink(short param_1) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54e_badSink((int)param_1); return; }
['gcc']
48,047
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54d_goodG2BSink(short data) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54e_goodG2BSink(data); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86894/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54d.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54d_goodG2BSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54d_goodG2BSink(short param_1) { CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54e_goodG2BSink((int)param_1); return; }
['gcc']
48,048
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54e_badSink(short data) { /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86894/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54e.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54e_badSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54e_badSink(short param_1) { long lVar1; if (param_1 < 100) { lVar1 = func_0x00400d40((long)param_1); func_0x00400cd0(lVar1,0x41,(long)(param_1 + -1)); *(undefined *)(lVar1 + (long)param_1 + -1) = 0; printLine(lVar1); func_0x00400c70(lVar1); } return; }
['gcc']
48,049
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54e_goodG2BSink(short data) { /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86894/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54e.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54e_goodG2BSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_54e_goodG2BSink(short param_1) { long lVar1; if (param_1 < 100) { lVar1 = func_0x00400b00((long)param_1); func_0x00400aa0(lVar1,0x41,(long)(param_1 + -1)); *(undefined *)(lVar1 + (long)param_1 + -1) = 0; printLine(lVar1); func_0x00400a60(lVar1); } return; }
['gcc']
48,050
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_61_bad() { short data; /* Initialize data */ data = 0; data = CWE194_Unexpected_Sign_Extension__listen_socket_malloc_61b_badSource(data); /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86895/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_61a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_61_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_61_bad(void) { short sVar1; long lVar2; sVar1 = CWE194_Unexpected_Sign_Extension__listen_socket_malloc_61b_badSource(0); if (sVar1 < 100) { lVar2 = func_0x00400d40((long)sVar1); func_0x00400cd0(lVar2,0x41,(long)(sVar1 + -1)); *(undefined *)(lVar2 + (long)sVar1 + -1) = 0; printLine(lVar2); func_0x00400c70(lVar2); } return; }
['gcc']
48,051
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_61_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86895/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_61a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_61_good
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_61_good(void) { goodG2B(); return; }
['gcc']
48,052
short CWE194_Unexpected_Sign_Extension__listen_socket_malloc_61b_badSource(short data) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } return data; }
['/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86895/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_61b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_61b_badSource
undefined2 CWE194_Unexpected_Sign_Extension__listen_socket_malloc_61b_badSource(undefined2 param_1) { int iVar1; undefined2 uStack_3c; undefined auStack_30 [8]; undefined2 uStack_28; undefined2 uStack_26; undefined4 uStack_24; int iStack_18; int iStack_14; int iStack_10; int iStack_c; iStack_10 = 0xffffffff; iStack_c = -1; iStack_10 = func_0x00400dd0(2,1,6); uStack_3c = param_1; if (iStack_10 != -1) { func_0x00400cd0(&uStack_28,0,0x10); uStack_28 = 2; uStack_24 = 0; uStack_26 = func_0x00400cb0(0x6987); iVar1 = func_0x00400d80(iStack_10,&uStack_28,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d70(iStack_10,5), iVar1 != -1)) && (iStack_c = func_0x00400d90(iStack_10,0,0), iStack_c != -1)) && ((iStack_14 = func_0x00400c80(iStack_c,auStack_30,7,0), iStack_14 != -1 && (iStack_14 != 0))) ) { auStack_30[iStack_14] = 0; iStack_18 = func_0x00400da0(auStack_30); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { uStack_3c = (undefined2)iStack_18; } else { uStack_3c = 0xffff; } } } if (iStack_10 != -1) { func_0x00400ce0(iStack_10); } if (iStack_c != -1) { func_0x00400ce0(iStack_c); } return uStack_3c; }
['gcc']
48,053
short CWE194_Unexpected_Sign_Extension__listen_socket_malloc_61b_goodG2BSource(short data) { /* FIX: Use a positive integer less than &InitialDataSize&*/ data = 100-1; return data; }
['/* FIX: Use a positive integer less than &InitialDataSize&*/']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86895/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_61b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_61b_goodG2BSource
undefined2 CWE194_Unexpected_Sign_Extension__listen_socket_malloc_61b_goodG2BSource(void) { return 99; }
['gcc']
48,054
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_63_bad() { short data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } CWE194_Unexpected_Sign_Extension__listen_socket_malloc_63b_badSink(&data); }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86897/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_63a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_63_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_63_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; undefined2 uStack_1a; int iStack_18; int iStack_14; int iStack_10; int iStack_c; uStack_1a = 0; iStack_10 = 0xffffffff; iStack_c = -1; iStack_10 = func_0x00400dd0(2,1,6); if (iStack_10 != -1) { func_0x00400cd0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400cb0(0x6987); iVar1 = func_0x00400d80(iStack_10,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d70(iStack_10,5), iVar1 != -1)) && (iStack_c = func_0x00400d90(iStack_10,0,0), iStack_c != -1)) && ((iStack_14 = func_0x00400c80(iStack_c,auStack_40,7,0), iStack_14 != -1 && (iStack_14 != 0))) ) { auStack_40[iStack_14] = 0; iStack_18 = func_0x00400da0(auStack_40); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { uStack_1a = (undefined2)iStack_18; } else { uStack_1a = 0xffff; } } } if (iStack_10 != -1) { func_0x00400ce0(iStack_10); } if (iStack_c != -1) { func_0x00400ce0(iStack_c); } CWE194_Unexpected_Sign_Extension__listen_socket_malloc_63b_badSink(&uStack_1a); return; }
['gcc']
48,055
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_63_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86897/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_63a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_63_good
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_63_good(void) { goodG2B(); return; }
['gcc']
48,056
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_63b_badSink(short * dataPtr) { short data = *dataPtr; /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86897/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_63b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_63b_badSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_63b_badSink(short *param_1) { short sVar1; long lVar2; sVar1 = *param_1; if (sVar1 < 100) { lVar2 = func_0x00400d40((long)sVar1); func_0x00400cd0(lVar2,0x41,(long)(sVar1 + -1)); *(undefined *)(lVar2 + (long)sVar1 + -1) = 0; printLine(lVar2); func_0x00400c70(lVar2); } return; }
['gcc']
48,057
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_63b_goodG2BSink(short * dataPtr) { short data = *dataPtr; /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86897/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_63b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_63b_goodG2BSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_63b_goodG2BSink(short *param_1) { short sVar1; long lVar2; sVar1 = *param_1; if (sVar1 < 100) { lVar2 = func_0x00400b00((long)sVar1); func_0x00400aa0(lVar2,0x41,(long)(sVar1 + -1)); *(undefined *)(lVar2 + (long)sVar1 + -1) = 0; printLine(lVar2); func_0x00400a60(lVar2); } return; }
['gcc']
48,058
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_64_bad() { short data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } CWE194_Unexpected_Sign_Extension__listen_socket_malloc_64b_badSink(&data); }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86898/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_64a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_64_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_64_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; undefined2 uStack_1a; int iStack_18; int iStack_14; int iStack_10; int iStack_c; uStack_1a = 0; iStack_10 = 0xffffffff; iStack_c = -1; iStack_10 = func_0x00400dd0(2,1,6); if (iStack_10 != -1) { func_0x00400cd0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400cb0(0x6987); iVar1 = func_0x00400d80(iStack_10,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d70(iStack_10,5), iVar1 != -1)) && (iStack_c = func_0x00400d90(iStack_10,0,0), iStack_c != -1)) && ((iStack_14 = func_0x00400c80(iStack_c,auStack_40,7,0), iStack_14 != -1 && (iStack_14 != 0))) ) { auStack_40[iStack_14] = 0; iStack_18 = func_0x00400da0(auStack_40); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { uStack_1a = (undefined2)iStack_18; } else { uStack_1a = 0xffff; } } } if (iStack_10 != -1) { func_0x00400ce0(iStack_10); } if (iStack_c != -1) { func_0x00400ce0(iStack_c); } CWE194_Unexpected_Sign_Extension__listen_socket_malloc_64b_badSink(&uStack_1a); return; }
['gcc']
48,059
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_64_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86898/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_64a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_64_good
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_64_good(void) { goodG2B(); return; }
['gcc']
48,060
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_64b_badSink(void * dataVoidPtr) { /* cast void pointer to a pointer of the appropriate type */ short * dataPtr = (short *)dataVoidPtr; /* dereference dataPtr into data */ short data = (*dataPtr); /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* cast void pointer to a pointer of the appropriate type */', '/* dereference dataPtr into data */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86898/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_64b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_64b_badSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_64b_badSink(short *param_1) { short sVar1; long lVar2; sVar1 = *param_1; if (sVar1 < 100) { lVar2 = func_0x00400d40((long)sVar1); func_0x00400cd0(lVar2,0x41,(long)(sVar1 + -1)); *(undefined *)(lVar2 + (long)sVar1 + -1) = 0; printLine(lVar2); func_0x00400c70(lVar2); } return; }
['gcc']
48,061
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_64b_goodG2BSink(void * dataVoidPtr) { /* cast void pointer to a pointer of the appropriate type */ short * dataPtr = (short *)dataVoidPtr; /* dereference dataPtr into data */ short data = (*dataPtr); /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* cast void pointer to a pointer of the appropriate type */', '/* dereference dataPtr into data */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86898/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_64b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_64b_goodG2BSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_64b_goodG2BSink(short *param_1) { short sVar1; long lVar2; sVar1 = *param_1; if (sVar1 < 100) { lVar2 = func_0x00400b00((long)sVar1); func_0x00400aa0(lVar2,0x41,(long)(sVar1 + -1)); *(undefined *)(lVar2 + (long)sVar1 + -1) = 0; printLine(lVar2); func_0x00400a60(lVar2); } return; }
['gcc']
48,062
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_65_bad() { short data; /* define a function pointer */ void (*funcPtr) (short) = CWE194_Unexpected_Sign_Extension__listen_socket_malloc_65b_badSink; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } /* use the function pointer */ funcPtr(data); }
['/* define a function pointer */', '/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* use the function pointer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86899/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_65a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_65_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_65_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_24; int iStack_20; int iStack_1c; code *pcStack_18; int iStack_10; short sStack_a; pcStack_18 = CWE194_Unexpected_Sign_Extension__listen_socket_malloc_65b_badSink; sStack_a = 0; iStack_1c = 0xffffffff; iStack_10 = -1; iStack_1c = func_0x00400dd0(2,1,6); if (iStack_1c != -1) { func_0x00400cd0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400cb0(0x6987); iVar1 = func_0x00400d80(iStack_1c,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d70(iStack_1c,5), iVar1 != -1)) && (iStack_10 = func_0x00400d90(iStack_1c,0,0), iStack_10 != -1)) && ((iStack_20 = func_0x00400c80(iStack_10,auStack_40,7,0), iStack_20 != -1 && (iStack_20 != 0)) )) { auStack_40[iStack_20] = 0; iStack_24 = func_0x00400da0(auStack_40); if ((iStack_24 < 0x8000) && (-0x8001 < iStack_24)) { sStack_a = (short)iStack_24; } else { sStack_a = -1; } } } if (iStack_1c != -1) { func_0x00400ce0(iStack_1c); } if (iStack_10 != -1) { func_0x00400ce0(iStack_10); } (*pcStack_18)((int)sStack_a); return; }
['gcc']
48,063
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_65_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86899/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_65a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_65_good
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_65_good(void) { goodG2B(); return; }
['gcc']
48,064
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_65b_badSink(short data) { /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86899/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_65b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_65b_badSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_65b_badSink(short param_1) { long lVar1; if (param_1 < 100) { lVar1 = func_0x00400d40((long)param_1); func_0x00400cd0(lVar1,0x41,(long)(param_1 + -1)); *(undefined *)(lVar1 + (long)param_1 + -1) = 0; printLine(lVar1); func_0x00400c70(lVar1); } return; }
['gcc']
48,065
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_65b_goodG2BSink(short data) { /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86899/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_65b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_65b_goodG2BSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_65b_goodG2BSink(short param_1) { long lVar1; if (param_1 < 100) { lVar1 = func_0x00400b00((long)param_1); func_0x00400aa0(lVar1,0x41,(long)(param_1 + -1)); *(undefined *)(lVar1 + (long)param_1 + -1) = 0; printLine(lVar1); func_0x00400a60(lVar1); } return; }
['gcc']
48,066
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_66_bad() { short data; short dataArray[5]; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } /* put data in array */ dataArray[2] = data; CWE194_Unexpected_Sign_Extension__listen_socket_malloc_66b_badSink(dataArray); }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* put data in array */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86900/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_66a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_66_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_66_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; undefined auStack_26 [4]; undefined2 uStack_22; int iStack_1c; int iStack_18; int iStack_14; int iStack_10; undefined2 uStack_a; uStack_a = 0; iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400dd0(2,1,6); if (iStack_14 != -1) { func_0x00400cd0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400cb0(0x6987); iVar1 = func_0x00400d80(iStack_14,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d70(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d90(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c80(iStack_10,auStack_40,7,0), iStack_18 != -1 && (iStack_18 != 0)) )) { auStack_40[iStack_18] = 0; iStack_1c = func_0x00400da0(auStack_40); if ((iStack_1c < 0x8000) && (-0x8001 < iStack_1c)) { uStack_a = (undefined2)iStack_1c; } else { uStack_a = 0xffff; } } } if (iStack_14 != -1) { func_0x00400ce0(iStack_14); } if (iStack_10 != -1) { func_0x00400ce0(iStack_10); } uStack_22 = uStack_a; CWE194_Unexpected_Sign_Extension__listen_socket_malloc_66b_badSink(auStack_26); return; }
['gcc']
48,067
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_66_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86900/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_66a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_66_good
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_66_good(void) { goodG2B(); return; }
['gcc']
48,068
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_66b_badSink(short dataArray[]) { /* copy data out of dataArray */ short data = dataArray[2]; /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* copy data out of dataArray */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86900/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_66b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_66b_badSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_66b_badSink(long param_1) { short sVar1; long lVar2; sVar1 = *(short *)(param_1 + 4); if (sVar1 < 100) { lVar2 = func_0x00400d40((long)sVar1); func_0x00400cd0(lVar2,0x41,(long)(sVar1 + -1)); *(undefined *)(lVar2 + (long)sVar1 + -1) = 0; printLine(lVar2); func_0x00400c70(lVar2); } return; }
['gcc']
48,069
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_66b_goodG2BSink(short dataArray[]) { short data = dataArray[2]; /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86900/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_66b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_66b_goodG2BSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_66b_goodG2BSink(long param_1) { short sVar1; long lVar2; sVar1 = *(short *)(param_1 + 4); if (sVar1 < 100) { lVar2 = func_0x00400b00((long)sVar1); func_0x00400aa0(lVar2,0x41,(long)(sVar1 + -1)); *(undefined *)(lVar2 + (long)sVar1 + -1) = 0; printLine(lVar2); func_0x00400a60(lVar2); } return; }
['gcc']
48,070
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_67_bad() { short data; CWE194_Unexpected_Sign_Extension__listen_socket_malloc_67_structType myStruct; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } myStruct.structFirst = data; CWE194_Unexpected_Sign_Extension__listen_socket_malloc_67b_badSink(myStruct); }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86901/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_67a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_67_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_67_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; undefined2 uStack_1e; int iStack_1c; int iStack_18; int iStack_14; int iStack_10; undefined2 uStack_a; uStack_a = 0; iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400dd0(2,1,6); if (iStack_14 != -1) { func_0x00400cd0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400cb0(0x6987); iVar1 = func_0x00400d80(iStack_14,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d70(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d90(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c80(iStack_10,auStack_40,7,0), iStack_18 != -1 && (iStack_18 != 0)) )) { auStack_40[iStack_18] = 0; iStack_1c = func_0x00400da0(auStack_40); if ((iStack_1c < 0x8000) && (-0x8001 < iStack_1c)) { uStack_a = (undefined2)iStack_1c; } else { uStack_a = 0xffff; } } } if (iStack_14 != -1) { func_0x00400ce0(iStack_14); } if (iStack_10 != -1) { func_0x00400ce0(iStack_10); } uStack_1e = uStack_a; CWE194_Unexpected_Sign_Extension__listen_socket_malloc_67b_badSink(uStack_a); return; }
['gcc']
48,071
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_67_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86901/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_67a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_67_good
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_67_good(void) { goodG2B(); return; }
['gcc']
48,072
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_67b_badSink(CWE194_Unexpected_Sign_Extension__listen_socket_malloc_67_structType myStruct) { short data = myStruct.structFirst; /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86901/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_67b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_67b_badSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_67b_badSink(short param_1) { long lVar1; if (param_1 < 100) { lVar1 = func_0x00400d40((long)param_1); func_0x00400cd0(lVar1,0x41,(long)(param_1 + -1)); *(undefined *)(lVar1 + (long)param_1 + -1) = 0; printLine(lVar1); func_0x00400c70(lVar1); } return; }
['gcc']
48,073
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_67b_goodG2BSink(CWE194_Unexpected_Sign_Extension__listen_socket_malloc_67_structType myStruct) { short data = myStruct.structFirst; /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86901/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_67b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_67b_goodG2BSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_67b_goodG2BSink(short param_1) { long lVar1; if (param_1 < 100) { lVar1 = func_0x00400b00((long)param_1); func_0x00400aa0(lVar1,0x41,(long)(param_1 + -1)); *(undefined *)(lVar1 + (long)param_1 + -1) = 0; printLine(lVar1); func_0x00400a60(lVar1); } return; }
['gcc']
48,074
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_bad() { short data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_badData = data; CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68b_badSink(); }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86902/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; int iStack_10; undefined2 uStack_a; uStack_a = 0; iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400dd0(2,1,6); if (iStack_14 != -1) { func_0x00400cd0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400cb0(0x6987); iVar1 = func_0x00400d80(iStack_14,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d70(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d90(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c80(iStack_10,auStack_40,7,0), iStack_18 != -1 && (iStack_18 != 0)) )) { auStack_40[iStack_18] = 0; iStack_1c = func_0x00400da0(auStack_40); if ((iStack_1c < 0x8000) && (-0x8001 < iStack_1c)) { uStack_a = (undefined2)iStack_1c; } else { uStack_a = 0xffff; } } } if (iStack_14 != -1) { func_0x00400ce0(iStack_14); } if (iStack_10 != -1) { func_0x00400ce0(iStack_10); } CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_badData = uStack_a; CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68b_badSink(); return; }
['gcc']
48,075
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86902/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68a.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_good
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_good(void) { goodG2B(); return; }
['gcc']
48,076
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68b_badSink() { short data = CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_badData; /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86902/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68b_badSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68b_badSink(void) { short sVar1; long lVar2; sVar1 = CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_badData; if (CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_badData < 100) { lVar2 = func_0x00400d40((long)CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_badData) ; func_0x00400cd0(lVar2,0x41,(long)(sVar1 + -1)); *(undefined *)(lVar2 + (long)sVar1 + -1) = 0; printLine(lVar2); func_0x00400c70(lVar2); } return; }
['gcc']
48,077
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68b_goodG2BSink() { short data = CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_goodG2BData; /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86902/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68b.c
CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68b_goodG2BSink
void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68b_goodG2BSink(void) { short sVar1; long lVar2; sVar1 = CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_goodG2BData; if (CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_goodG2BData < 100) { lVar2 = func_0x00400b00((long) CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_goodG2BData); func_0x00400aa0(lVar2,0x41,(long)(sVar1 + -1)); *(undefined *)(lVar2 + (long)sVar1 + -1) = 0; printLine(lVar2); func_0x00400a60(lVar2); } return; }
['gcc']
48,078
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_01_bad() { short data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } { char source[100]; char dest[100] = ""; memset(source, 'A', 100-1); source[100-1] = '\0'; if (data < 100) { /* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative, * the sign extension could result in a very large number */ memcpy(dest, source, data); dest[data] = '\0'; /* NULL terminate */ } printLine(dest); } }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative,\r\n * the sign extension could result in a very large number */', '/* NULL terminate */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86910/CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_01.c
CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_01_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_01_bad(void) { int iVar1; undefined auStack_118 [99]; undefined uStack_b5; 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; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400da0(2,1,6); if (iStack_14 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d50(iStack_14,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d40(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d60(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_18 != -1 && (iStack_18 != 0)) )) { auStack_40[iStack_18] = 0; iStack_1c = func_0x00400d70(auStack_40); if ((iStack_1c < 0x8000) && (-0x8001 < iStack_1c)) { sStack_a = (short)iStack_1c; } else { sStack_a = -1; } } } if (iStack_14 != -1) { func_0x00400cb0(iStack_14); } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } 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; func_0x00400ca0(auStack_118,0x41,99); uStack_b5 = 0; if (sStack_a < 100) { func_0x00400d00(&uStack_a8,auStack_118,(long)sStack_a); *(undefined *)((long)&uStack_a8 + (long)(int)sStack_a) = 0; } printLine(&uStack_a8); return; }
['gcc']
48,079
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_01_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86910/CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_01.c
CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_01_good
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_01_good(void) { goodG2B(); return; }
['gcc']
48,080
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_02_bad() { short data; /* Initialize data */ data = 0; if(1) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } { char source[100]; char dest[100] = ""; memset(source, 'A', 100-1); source[100-1] = '\0'; if (data < 100) { /* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative, * the sign extension could result in a very large number */ memcpy(dest, source, data); dest[data] = '\0'; /* NULL terminate */ } printLine(dest); } }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative,\r\n * the sign extension could result in a very large number */', '/* NULL terminate */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86911/CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_02.c
CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_02_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_02_bad(void) { int iVar1; undefined auStack_118 [99]; undefined uStack_b5; 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; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400da0(2,1,6); if (iStack_14 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d50(iStack_14,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d40(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d60(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_18 != -1 && (iStack_18 != 0)) )) { auStack_40[iStack_18] = 0; iStack_1c = func_0x00400d70(auStack_40); if ((iStack_1c < 0x8000) && (-0x8001 < iStack_1c)) { sStack_a = (short)iStack_1c; } else { sStack_a = -1; } } } if (iStack_14 != -1) { func_0x00400cb0(iStack_14); } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } 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; func_0x00400ca0(auStack_118,0x41,99); uStack_b5 = 0; if (sStack_a < 100) { func_0x00400d00(&uStack_a8,auStack_118,(long)sStack_a); *(undefined *)((long)&uStack_a8 + (long)(int)sStack_a) = 0; } printLine(&uStack_a8); return; }
['gcc']
48,081
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_02_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86911/CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_02.c
CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_02_good
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_02_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
48,082
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_03_bad() { short data; /* Initialize data */ data = 0; if(5==5) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } { char source[100]; char dest[100] = ""; memset(source, 'A', 100-1); source[100-1] = '\0'; if (data < 100) { /* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative, * the sign extension could result in a very large number */ memcpy(dest, source, data); dest[data] = '\0'; /* NULL terminate */ } printLine(dest); } }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative,\r\n * the sign extension could result in a very large number */', '/* NULL terminate */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86912/CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_03.c
CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_03_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_03_bad(void) { int iVar1; undefined auStack_118 [99]; undefined uStack_b5; 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; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400da0(2,1,6); if (iStack_14 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d50(iStack_14,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d40(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d60(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_18 != -1 && (iStack_18 != 0)) )) { auStack_40[iStack_18] = 0; iStack_1c = func_0x00400d70(auStack_40); if ((iStack_1c < 0x8000) && (-0x8001 < iStack_1c)) { sStack_a = (short)iStack_1c; } else { sStack_a = -1; } } } if (iStack_14 != -1) { func_0x00400cb0(iStack_14); } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } 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; func_0x00400ca0(auStack_118,0x41,99); uStack_b5 = 0; if (sStack_a < 100) { func_0x00400d00(&uStack_a8,auStack_118,(long)sStack_a); *(undefined *)((long)&uStack_a8 + (long)(int)sStack_a) = 0; } printLine(&uStack_a8); return; }
['gcc']
48,083
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_03_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86912/CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_03.c
CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_03_good
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_03_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
48,084
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_04_bad() { short data; /* Initialize data */ data = 0; if(STATIC_CONST_TRUE) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } { char source[100]; char dest[100] = ""; memset(source, 'A', 100-1); source[100-1] = '\0'; if (data < 100) { /* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative, * the sign extension could result in a very large number */ memcpy(dest, source, data); dest[data] = '\0'; /* NULL terminate */ } printLine(dest); } }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative,\r\n * the sign extension could result in a very large number */', '/* NULL terminate */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86913/CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_04.c
CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_04_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_04_bad(void) { int iVar1; undefined auStack_118 [99]; undefined uStack_b5; 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; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400da0(2,1,6); if (iStack_14 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d50(iStack_14,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d40(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d60(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_18 != -1 && (iStack_18 != 0)) )) { auStack_40[iStack_18] = 0; iStack_1c = func_0x00400d70(auStack_40); if ((iStack_1c < 0x8000) && (-0x8001 < iStack_1c)) { sStack_a = (short)iStack_1c; } else { sStack_a = -1; } } } if (iStack_14 != -1) { func_0x00400cb0(iStack_14); } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } 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; func_0x00400ca0(auStack_118,0x41,99); uStack_b5 = 0; if (sStack_a < 100) { func_0x00400d00(&uStack_a8,auStack_118,(long)sStack_a); *(undefined *)((long)&uStack_a8 + (long)(int)sStack_a) = 0; } printLine(&uStack_a8); return; }
['gcc']
48,085
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_04_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86913/CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_04.c
CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_04_good
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_04_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
48,086
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_05_bad() { short data; /* Initialize data */ data = 0; if(staticTrue) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } { char source[100]; char dest[100] = ""; memset(source, 'A', 100-1); source[100-1] = '\0'; if (data < 100) { /* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative, * the sign extension could result in a very large number */ memcpy(dest, source, data); dest[data] = '\0'; /* NULL terminate */ } printLine(dest); } }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative,\r\n * the sign extension could result in a very large number */', '/* NULL terminate */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86914/CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_05.c
CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_05_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_05_bad(void) { int iVar1; undefined auStack_118 [99]; undefined uStack_b5; 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; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; if (staticTrue != 0) { iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400da0(2,1,6); if (iStack_14 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d50(iStack_14,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d40(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d60(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_18 != -1 && (iStack_18 != 0)))) { auStack_40[iStack_18] = 0; iStack_1c = func_0x00400d70(auStack_40); if ((iStack_1c < 0x8000) && (-0x8001 < iStack_1c)) { sStack_a = (short)iStack_1c; } else { sStack_a = -1; } } } if (iStack_14 != -1) { func_0x00400cb0(iStack_14); } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } } 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; func_0x00400ca0(auStack_118,0x41,99); uStack_b5 = 0; if (sStack_a < 100) { func_0x00400d00(&uStack_a8,auStack_118,(long)sStack_a); *(undefined *)((long)&uStack_a8 + (long)(int)sStack_a) = 0; } printLine(&uStack_a8); return; }
['gcc']
48,087
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_05_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86914/CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_05.c
CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_05_good
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_05_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
48,088
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_06_bad() { short data; /* Initialize data */ data = 0; if(STATIC_CONST_FIVE==5) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } { char source[100]; char dest[100] = ""; memset(source, 'A', 100-1); source[100-1] = '\0'; if (data < 100) { /* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative, * the sign extension could result in a very large number */ memcpy(dest, source, data); dest[data] = '\0'; /* NULL terminate */ } printLine(dest); } }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative,\r\n * the sign extension could result in a very large number */', '/* NULL terminate */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86915/CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_06.c
CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_06_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_06_bad(void) { int iVar1; undefined auStack_118 [99]; undefined uStack_b5; 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; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400da0(2,1,6); if (iStack_14 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d50(iStack_14,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d40(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d60(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_18 != -1 && (iStack_18 != 0)) )) { auStack_40[iStack_18] = 0; iStack_1c = func_0x00400d70(auStack_40); if ((iStack_1c < 0x8000) && (-0x8001 < iStack_1c)) { sStack_a = (short)iStack_1c; } else { sStack_a = -1; } } } if (iStack_14 != -1) { func_0x00400cb0(iStack_14); } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } 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; func_0x00400ca0(auStack_118,0x41,99); uStack_b5 = 0; if (sStack_a < 100) { func_0x00400d00(&uStack_a8,auStack_118,(long)sStack_a); *(undefined *)((long)&uStack_a8 + (long)(int)sStack_a) = 0; } printLine(&uStack_a8); return; }
['gcc']
48,089
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_06_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86915/CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_06.c
CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_06_good
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_06_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
48,090
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_07_bad() { short data; /* Initialize data */ data = 0; if(staticFive==5) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } { char source[100]; char dest[100] = ""; memset(source, 'A', 100-1); source[100-1] = '\0'; if (data < 100) { /* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative, * the sign extension could result in a very large number */ memcpy(dest, source, data); dest[data] = '\0'; /* NULL terminate */ } printLine(dest); } }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative,\r\n * the sign extension could result in a very large number */', '/* NULL terminate */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86916/CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_07.c
CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_07_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_07_bad(void) { int iVar1; undefined auStack_118 [99]; undefined uStack_b5; 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; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; if (staticFive == 5) { iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400da0(2,1,6); if (iStack_14 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d50(iStack_14,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d40(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d60(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_18 != -1 && (iStack_18 != 0)))) { auStack_40[iStack_18] = 0; iStack_1c = func_0x00400d70(auStack_40); if ((iStack_1c < 0x8000) && (-0x8001 < iStack_1c)) { sStack_a = (short)iStack_1c; } else { sStack_a = -1; } } } if (iStack_14 != -1) { func_0x00400cb0(iStack_14); } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } } 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; func_0x00400ca0(auStack_118,0x41,99); uStack_b5 = 0; if (sStack_a < 100) { func_0x00400d00(&uStack_a8,auStack_118,(long)sStack_a); *(undefined *)((long)&uStack_a8 + (long)(int)sStack_a) = 0; } printLine(&uStack_a8); return; }
['gcc']
48,091
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_07_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86916/CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_07.c
CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_07_good
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_07_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
48,092
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_08_bad() { short data; /* Initialize data */ data = 0; if(staticReturnsTrue()) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } { char source[100]; char dest[100] = ""; memset(source, 'A', 100-1); source[100-1] = '\0'; if (data < 100) { /* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative, * the sign extension could result in a very large number */ memcpy(dest, source, data); dest[data] = '\0'; /* NULL terminate */ } printLine(dest); } }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative,\r\n * the sign extension could result in a very large number */', '/* NULL terminate */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86917/CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_08.c
CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_08_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_08_bad(void) { int iVar1; undefined auStack_118 [99]; undefined uStack_b5; 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; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iVar1 = staticReturnsTrue(); if (iVar1 != 0) { iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400da0(2,1,6); if (iStack_14 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d50(iStack_14,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d40(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d60(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_18 != -1 && (iStack_18 != 0)))) { auStack_40[iStack_18] = 0; iStack_1c = func_0x00400d70(auStack_40); if ((iStack_1c < 0x8000) && (-0x8001 < iStack_1c)) { sStack_a = (short)iStack_1c; } else { sStack_a = -1; } } } if (iStack_14 != -1) { func_0x00400cb0(iStack_14); } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } } 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; func_0x00400ca0(auStack_118,0x41,99); uStack_b5 = 0; if (sStack_a < 100) { func_0x00400d00(&uStack_a8,auStack_118,(long)sStack_a); *(undefined *)((long)&uStack_a8 + (long)(int)sStack_a) = 0; } printLine(&uStack_a8); return; }
['gcc']
48,093
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_08_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86917/CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_08.c
CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_08_good
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_08_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
48,094
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_09_bad() { short data; /* Initialize data */ data = 0; if(GLOBAL_CONST_TRUE) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } { char source[100]; char dest[100] = ""; memset(source, 'A', 100-1); source[100-1] = '\0'; if (data < 100) { /* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative, * the sign extension could result in a very large number */ memcpy(dest, source, data); dest[data] = '\0'; /* NULL terminate */ } printLine(dest); } }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative,\r\n * the sign extension could result in a very large number */', '/* NULL terminate */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86918/CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_09.c
CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_09_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_09_bad(void) { int iVar1; undefined auStack_118 [99]; undefined uStack_b5; 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; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; if (GLOBAL_CONST_TRUE != 0) { iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400da0(2,1,6); if (iStack_14 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d50(iStack_14,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d40(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d60(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_18 != -1 && (iStack_18 != 0)))) { auStack_40[iStack_18] = 0; iStack_1c = func_0x00400d70(auStack_40); if ((iStack_1c < 0x8000) && (-0x8001 < iStack_1c)) { sStack_a = (short)iStack_1c; } else { sStack_a = -1; } } } if (iStack_14 != -1) { func_0x00400cb0(iStack_14); } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } } 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; func_0x00400ca0(auStack_118,0x41,99); uStack_b5 = 0; if (sStack_a < 100) { func_0x00400d00(&uStack_a8,auStack_118,(long)sStack_a); *(undefined *)((long)&uStack_a8 + (long)(int)sStack_a) = 0; } printLine(&uStack_a8); return; }
['gcc']
48,095
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_09_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86918/CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_09.c
CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_09_good
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_09_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
48,096
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_10_bad() { short data; /* Initialize data */ data = 0; if(globalTrue) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } { char source[100]; char dest[100] = ""; memset(source, 'A', 100-1); source[100-1] = '\0'; if (data < 100) { /* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative, * the sign extension could result in a very large number */ memcpy(dest, source, data); dest[data] = '\0'; /* NULL terminate */ } printLine(dest); } }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative,\r\n * the sign extension could result in a very large number */', '/* NULL terminate */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86919/CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_10.c
CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_10_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_10_bad(void) { int iVar1; undefined auStack_118 [99]; undefined uStack_b5; 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; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; if (globalTrue != 0) { iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400da0(2,1,6); if (iStack_14 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d50(iStack_14,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d40(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d60(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_18 != -1 && (iStack_18 != 0)))) { auStack_40[iStack_18] = 0; iStack_1c = func_0x00400d70(auStack_40); if ((iStack_1c < 0x8000) && (-0x8001 < iStack_1c)) { sStack_a = (short)iStack_1c; } else { sStack_a = -1; } } } if (iStack_14 != -1) { func_0x00400cb0(iStack_14); } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } } 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; func_0x00400ca0(auStack_118,0x41,99); uStack_b5 = 0; if (sStack_a < 100) { func_0x00400d00(&uStack_a8,auStack_118,(long)sStack_a); *(undefined *)((long)&uStack_a8 + (long)(int)sStack_a) = 0; } printLine(&uStack_a8); return; }
['gcc']
48,097
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_10_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86919/CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_10.c
CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_10_good
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_10_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
48,098
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_11_bad() { short data; /* Initialize data */ data = 0; if(globalReturnsTrue()) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; 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); 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, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } { char source[100]; char dest[100] = ""; memset(source, 'A', 100-1); source[100-1] = '\0'; if (data < 100) { /* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative, * the sign extension could result in a very large number */ memcpy(dest, source, data); dest[data] = '\0'; /* NULL terminate */ } printLine(dest); } }
['/* Initialize data */', '/* Abort on error or the connection was closed */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative,\r\n * the sign extension could result in a very large number */', '/* NULL terminate */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86920/CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_11.c
CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_11_bad
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_11_bad(void) { int iVar1; undefined auStack_118 [99]; undefined uStack_b5; 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; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iVar1 = globalReturnsTrue(); if (iVar1 != 0) { iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400da0(2,1,6); if (iStack_14 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d50(iStack_14,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400d40(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d60(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_18 != -1 && (iStack_18 != 0)))) { auStack_40[iStack_18] = 0; iStack_1c = func_0x00400d70(auStack_40); if ((iStack_1c < 0x8000) && (-0x8001 < iStack_1c)) { sStack_a = (short)iStack_1c; } else { sStack_a = -1; } } } if (iStack_14 != -1) { func_0x00400cb0(iStack_14); } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } } 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; func_0x00400ca0(auStack_118,0x41,99); uStack_b5 = 0; if (sStack_a < 100) { func_0x00400d00(&uStack_a8,auStack_118,(long)sStack_a); *(undefined *)((long)&uStack_a8 + (long)(int)sStack_a) = 0; } printLine(&uStack_a8); return; }
['gcc']
48,099
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_11_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86920/CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_11.c
CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_11_good
void CWE194_Unexpected_Sign_Extension__listen_socket_memcpy_11_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']