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
11,800
size_t CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_61b_goodG2BSource(size_t data) { /* FIX: Use a relatively small number for memory allocation */ data = 20; return data; }
['/* FIX: Use a relatively small number for memory allocation */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117352/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_61b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_61b_goodG2BSource
undefined8 CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_61b_goodG2BSource(void) { return 0x14; }
['gcc']
11,801
size_t CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_61b_goodB2GSource(size_t data) { /* POTENTIAL FLAW: Read data from the console using fscanf() */ fscanf(stdin, "%ud", &data); return data; }
['/* POTENTIAL FLAW: Read data from the console using fscanf() */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117352/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_61b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_61b_goodB2GSource
undefined8 CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_61b_goodB2GSource(undefined8 param_1) { undefined8 uStack_10; uStack_10 = param_1; func_0x00400b60(stdin,&UNK_00401414,&uStack_10); return uStack_10; }
['gcc']
11,802
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_63_bad() { size_t data; /* Initialize data */ data = 0; /* POTENTIAL FLAW: Read data from the console using fscanf() */ fscanf(stdin, "%ud", &data); CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_63b_badSink(&data); }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data from the console using fscanf() */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117354/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_63a.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_63_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_63_bad(void) { undefined8 uStack_10; uStack_10 = 0; func_0x00400b60(stdin,&UNK_00401364,&uStack_10); CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_63b_badSink(&uStack_10); return; }
['gcc']
11,803
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_63_good() { goodG2B(); goodB2G(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117354/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_63a.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_63_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_63_good(void) { goodG2B(); goodB2G(); return; }
['gcc']
11,804
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_63b_badSink(size_t * dataPtr) { size_t data = *dataPtr; { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } }
['/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117354/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_63b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_63b_badSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_63b_badSink(ulong *param_1) { ulong uVar1; ulong uVar2; undefined8 uVar3; uVar1 = *param_1; uVar2 = func_0x00400ba0(&UNK_00401368); if (uVar2 < uVar1) { uVar3 = func_0x00400c10(uVar1 << 2); func_0x00400be0(uVar3,&UNK_00401368); printWLine(uVar3); func_0x00400b50(uVar3); } else { printLine(&UNK_00401380); } return; }
['gcc']
11,805
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_63b_goodG2BSink(size_t * dataPtr) { size_t data = *dataPtr; { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } }
['/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117354/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_63b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_63b_goodG2BSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_63b_goodG2BSink(ulong *param_1) { ulong uVar1; ulong uVar2; undefined8 uVar3; uVar1 = *param_1; uVar2 = func_0x00400ba0(&UNK_00401428); if (uVar2 < uVar1) { uVar3 = func_0x00400c10(uVar1 << 2); func_0x00400be0(uVar3,&UNK_00401428); printWLine(uVar3); func_0x00400b50(uVar3); } else { printLine(&UNK_00401440); } return; }
['gcc']
11,806
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_63b_goodB2GSink(size_t * dataPtr) { size_t data = *dataPtr; { wchar_t * myString; /* FIX: Include a MAXIMUM limitation for memory allocation and a check to ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING) && data < 100) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string or too large"); } } }
['/* FIX: Include a MAXIMUM limitation for memory allocation and a check to ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117354/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_63b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_63b_goodB2GSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_63b_goodB2GSink(ulong *param_1) { ulong uVar1; ulong uVar2; undefined8 uVar3; uVar1 = *param_1; uVar2 = func_0x00400ba0(&UNK_00401428); if ((uVar2 < uVar1) && (uVar1 < 100)) { uVar3 = func_0x00400c10(uVar1 << 2); func_0x00400be0(uVar3,&UNK_00401428); printWLine(uVar3); func_0x00400b50(uVar3); } else { printLine(&UNK_00401478); } return; }
['gcc']
11,807
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_64_bad() { size_t data; /* Initialize data */ data = 0; /* POTENTIAL FLAW: Read data from the console using fscanf() */ fscanf(stdin, "%ud", &data); CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_64b_badSink(&data); }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data from the console using fscanf() */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117355/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_64a.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_64_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_64_bad(void) { undefined8 uStack_10; uStack_10 = 0; func_0x00400b60(stdin,&UNK_00401364,&uStack_10); CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_64b_badSink(&uStack_10); return; }
['gcc']
11,808
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_64_good() { goodG2B(); goodB2G(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117355/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_64a.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_64_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_64_good(void) { goodG2B(); goodB2G(); return; }
['gcc']
11,809
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_64b_badSink(void * dataVoidPtr) { /* cast void pointer to a pointer of the appropriate type */ size_t * dataPtr = (size_t *)dataVoidPtr; /* dereference dataPtr into data */ size_t data = (*dataPtr); { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } }
['/* cast void pointer to a pointer of the appropriate type */', '/* dereference dataPtr into data */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117355/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_64b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_64b_badSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_64b_badSink(ulong *param_1) { ulong uVar1; ulong uVar2; undefined8 uVar3; uVar1 = *param_1; uVar2 = func_0x00400ba0(&UNK_00401368); if (uVar2 < uVar1) { uVar3 = func_0x00400c10(uVar1 << 2); func_0x00400be0(uVar3,&UNK_00401368); printWLine(uVar3); func_0x00400b50(uVar3); } else { printLine(&UNK_00401380); } return; }
['gcc']
11,810
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_64b_goodG2BSink(void * dataVoidPtr) { /* cast void pointer to a pointer of the appropriate type */ size_t * dataPtr = (size_t *)dataVoidPtr; /* dereference dataPtr into data */ size_t data = (*dataPtr); { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } }
['/* cast void pointer to a pointer of the appropriate type */', '/* dereference dataPtr into data */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117355/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_64b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_64b_goodG2BSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_64b_goodG2BSink(ulong *param_1) { ulong uVar1; ulong uVar2; undefined8 uVar3; uVar1 = *param_1; uVar2 = func_0x00400ba0(&UNK_00401438); if (uVar2 < uVar1) { uVar3 = func_0x00400c10(uVar1 << 2); func_0x00400be0(uVar3,&UNK_00401438); printWLine(uVar3); func_0x00400b50(uVar3); } else { printLine(&UNK_00401450); } return; }
['gcc']
11,811
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_64b_goodB2GSink(void * dataVoidPtr) { /* cast void pointer to a pointer of the appropriate type */ size_t * dataPtr = (size_t *)dataVoidPtr; /* dereference dataPtr into data */ size_t data = (*dataPtr); { wchar_t * myString; /* FIX: Include a MAXIMUM limitation for memory allocation and a check to ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING) && data < 100) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string or too large"); } } }
['/* cast void pointer to a pointer of the appropriate type */', '/* dereference dataPtr into data */', '/* FIX: Include a MAXIMUM limitation for memory allocation and a check to ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117355/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_64b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_64b_goodB2GSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_64b_goodB2GSink(ulong *param_1) { ulong uVar1; ulong uVar2; undefined8 uVar3; uVar1 = *param_1; uVar2 = func_0x00400ba0(&UNK_00401438); if ((uVar2 < uVar1) && (uVar1 < 100)) { uVar3 = func_0x00400c10(uVar1 << 2); func_0x00400be0(uVar3,&UNK_00401438); printWLine(uVar3); func_0x00400b50(uVar3); } else { printLine(&UNK_00401488); } return; }
['gcc']
11,812
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_65_bad() { size_t data; /* define a function pointer */ void (*funcPtr) (size_t) = CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_65b_badSink; /* Initialize data */ data = 0; /* POTENTIAL FLAW: Read data from the console using fscanf() */ fscanf(stdin, "%ud", &data); /* use the function pointer */ funcPtr(data); }
['/* define a function pointer */', '/* Initialize data */', '/* POTENTIAL FLAW: Read data from the console using fscanf() */', '/* use the function pointer */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117356/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_65a.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_65_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_65_bad(void) { undefined8 uStack_18; code *pcStack_10; pcStack_10 = CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_65b_badSink; uStack_18 = 0; func_0x00400b60(stdin,&UNK_00401364,&uStack_18); (*pcStack_10)(uStack_18); return; }
['gcc']
11,813
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_65_good() { goodG2B(); goodB2G(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117356/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_65a.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_65_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_65_good(void) { goodG2B(); goodB2G(); return; }
['gcc']
11,814
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_65b_badSink(size_t data) { { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } }
['/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117356/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_65b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_65b_badSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_65b_badSink(ulong param_1) { ulong uVar1; undefined8 uVar2; uVar1 = func_0x00400ba0(&UNK_00401368); if (uVar1 < param_1) { uVar2 = func_0x00400c10(param_1 << 2); func_0x00400be0(uVar2,&UNK_00401368); printWLine(uVar2); func_0x00400b50(uVar2); } else { printLine(&UNK_00401380); } return; }
['gcc']
11,815
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_65b_goodG2BSink(size_t data) { { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } }
['/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117356/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_65b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_65b_goodG2BSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_65b_goodG2BSink(ulong param_1) { ulong uVar1; undefined8 uVar2; uVar1 = func_0x00400ba0(&UNK_00401418); if (uVar1 < param_1) { uVar2 = func_0x00400c10(param_1 << 2); func_0x00400be0(uVar2,&UNK_00401418); printWLine(uVar2); func_0x00400b50(uVar2); } else { printLine(&UNK_00401430); } return; }
['gcc']
11,816
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_65b_goodB2GSink(size_t data) { { wchar_t * myString; /* FIX: Include a MAXIMUM limitation for memory allocation and a check to ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING) && data < 100) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string or too large"); } } }
['/* FIX: Include a MAXIMUM limitation for memory allocation and a check to ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117356/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_65b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_65b_goodB2GSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_65b_goodB2GSink(ulong param_1) { ulong uVar1; undefined8 uVar2; uVar1 = func_0x00400ba0(&UNK_00401418); if ((uVar1 < param_1) && (param_1 < 100)) { uVar2 = func_0x00400c10(param_1 << 2); func_0x00400be0(uVar2,&UNK_00401418); printWLine(uVar2); func_0x00400b50(uVar2); } else { printLine(&UNK_00401468); } return; }
['gcc']
11,817
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_66_bad() { size_t data; size_t dataArray[5]; /* Initialize data */ data = 0; /* POTENTIAL FLAW: Read data from the console using fscanf() */ fscanf(stdin, "%ud", &data); /* put data in array */ dataArray[2] = data; CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_66b_badSink(dataArray); }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data from the console using fscanf() */', '/* put data in array */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117357/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_66a.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_66_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_66_bad(void) { undefined auStack_38 [16]; undefined8 uStack_28; undefined8 uStack_10; uStack_10 = 0; func_0x00400b60(stdin,&UNK_00401364,&uStack_10); uStack_28 = uStack_10; CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_66b_badSink(auStack_38); return; }
['gcc']
11,818
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_66_good() { goodG2B(); goodB2G(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117357/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_66a.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_66_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_66_good(void) { goodG2B(); goodB2G(); return; }
['gcc']
11,819
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_66b_badSink(size_t dataArray[]) { /* copy data out of dataArray */ size_t data = dataArray[2]; { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } }
['/* copy data out of dataArray */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117357/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_66b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_66b_badSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_66b_badSink(long param_1) { ulong uVar1; ulong uVar2; undefined8 uVar3; uVar1 = *(ulong *)(param_1 + 0x10); uVar2 = func_0x00400ba0(&UNK_00401368); if (uVar2 < uVar1) { uVar3 = func_0x00400c10(uVar1 << 2); func_0x00400be0(uVar3,&UNK_00401368); printWLine(uVar3); func_0x00400b50(uVar3); } else { printLine(&UNK_00401380); } return; }
['gcc']
11,820
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_66b_goodG2BSink(size_t dataArray[]) { size_t data = dataArray[2]; { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } }
['/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117357/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_66b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_66b_goodG2BSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_66b_goodG2BSink(long param_1) { ulong uVar1; ulong uVar2; undefined8 uVar3; uVar1 = *(ulong *)(param_1 + 0x10); uVar2 = func_0x00400ba0(&UNK_00401438); if (uVar2 < uVar1) { uVar3 = func_0x00400c10(uVar1 << 2); func_0x00400be0(uVar3,&UNK_00401438); printWLine(uVar3); func_0x00400b50(uVar3); } else { printLine(&UNK_00401450); } return; }
['gcc']
11,821
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_66b_goodB2GSink(size_t dataArray[]) { size_t data = dataArray[2]; { wchar_t * myString; /* FIX: Include a MAXIMUM limitation for memory allocation and a check to ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING) && data < 100) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string or too large"); } } }
['/* FIX: Include a MAXIMUM limitation for memory allocation and a check to ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117357/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_66b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_66b_goodB2GSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_66b_goodB2GSink(long param_1) { ulong uVar1; ulong uVar2; undefined8 uVar3; uVar1 = *(ulong *)(param_1 + 0x10); uVar2 = func_0x00400ba0(&UNK_00401438); if ((uVar2 < uVar1) && (uVar1 < 100)) { uVar3 = func_0x00400c10(uVar1 << 2); func_0x00400be0(uVar3,&UNK_00401438); printWLine(uVar3); func_0x00400b50(uVar3); } else { printLine(&UNK_00401488); } return; }
['gcc']
11,822
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67_bad() { size_t data; CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67_structType myStruct; /* Initialize data */ data = 0; /* POTENTIAL FLAW: Read data from the console using fscanf() */ fscanf(stdin, "%ud", &data); myStruct.structFirst = data; CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67b_badSink(myStruct); }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data from the console using fscanf() */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117358/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67a.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67_bad(void) { undefined8 uStack_10; uStack_10 = 0; func_0x00400b60(stdin,&UNK_00401364,&uStack_10); CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67b_badSink(uStack_10); return; }
['gcc']
11,823
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67_good() { goodG2B(); goodB2G(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117358/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67a.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67_good(void) { goodG2B(); goodB2G(); return; }
['gcc']
11,824
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67b_badSink(CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67_structType myStruct) { size_t data = myStruct.structFirst; { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } }
['/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117358/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67b_badSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67b_badSink(ulong param_1) { ulong uVar1; undefined8 uVar2; uVar1 = func_0x00400ba0(&UNK_00401368); if (uVar1 < param_1) { uVar2 = func_0x00400c10(param_1 << 2); func_0x00400be0(uVar2,&UNK_00401368); printWLine(uVar2); func_0x00400b50(uVar2); } else { printLine(&UNK_00401380); } return; }
['gcc']
11,825
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67b_goodG2BSink(CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67_structType myStruct) { size_t data = myStruct.structFirst; { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } }
['/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117358/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67b_goodG2BSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67b_goodG2BSink(ulong param_1) { ulong uVar1; undefined8 uVar2; uVar1 = func_0x00400ba0(&UNK_00401428); if (uVar1 < param_1) { uVar2 = func_0x00400c10(param_1 << 2); func_0x00400be0(uVar2,&UNK_00401428); printWLine(uVar2); func_0x00400b50(uVar2); } else { printLine(&UNK_00401440); } return; }
['gcc']
11,826
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67b_goodB2GSink(CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67_structType myStruct) { size_t data = myStruct.structFirst; { wchar_t * myString; /* FIX: Include a MAXIMUM limitation for memory allocation and a check to ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING) && data < 100) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string or too large"); } } }
['/* FIX: Include a MAXIMUM limitation for memory allocation and a check to ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117358/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67b_goodB2GSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_67b_goodB2GSink(ulong param_1) { ulong uVar1; undefined8 uVar2; uVar1 = func_0x00400ba0(&UNK_00401428); if ((uVar1 < param_1) && (param_1 < 100)) { uVar2 = func_0x00400c10(param_1 << 2); func_0x00400be0(uVar2,&UNK_00401428); printWLine(uVar2); func_0x00400b50(uVar2); } else { printLine(&UNK_00401478); } return; }
['gcc']
11,827
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68_bad() { size_t data; /* Initialize data */ data = 0; /* POTENTIAL FLAW: Read data from the console using fscanf() */ fscanf(stdin, "%ud", &data); CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68_badData = data; CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68b_badSink(); }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data from the console using fscanf() */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117359/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68a.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68_bad(void) { undefined8 uStack_10; uStack_10 = 0; func_0x00400b60(stdin,&UNK_00401364,&uStack_10); CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68_badData = uStack_10; CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68b_badSink(); return; }
['gcc']
11,828
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68_good() { goodG2B(); goodB2G(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117359/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68a.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68_good(void) { goodG2B(); goodB2G(); return; }
['gcc']
11,829
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68b_badSink() { size_t data = CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68_badData; { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } }
['/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117359/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68b_badSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68b_badSink(void) { ulong uVar1; ulong uVar2; undefined8 uVar3; uVar1 = CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68_badData; uVar2 = func_0x00400ba0(&UNK_00401368); if (uVar2 < uVar1) { uVar3 = func_0x00400c10(uVar1 << 2); func_0x00400be0(uVar3,&UNK_00401368); printWLine(uVar3); func_0x00400b50(uVar3); } else { printLine(&UNK_00401380); } return; }
['gcc']
11,830
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68b_goodG2BSink() { size_t data = CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68_goodG2BData; { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } }
['/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117359/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68b_goodG2BSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68b_goodG2BSink(void) { ulong uVar1; ulong uVar2; undefined8 uVar3; uVar1 = CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68_goodG2BData; uVar2 = func_0x00400ba0(&UNK_00401428); if (uVar2 < uVar1) { uVar3 = func_0x00400c10(uVar1 << 2); func_0x00400be0(uVar3,&UNK_00401428); printWLine(uVar3); func_0x00400b50(uVar3); } else { printLine(&UNK_00401440); } return; }
['gcc']
11,831
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68b_goodB2GSink() { size_t data = CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68_goodB2GData; { wchar_t * myString; /* FIX: Include a MAXIMUM limitation for memory allocation and a check to ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING) && data < 100) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string or too large"); } } }
['/* FIX: Include a MAXIMUM limitation for memory allocation and a check to ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117359/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68b_goodB2GSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68b_goodB2GSink(void) { ulong uVar1; ulong uVar2; undefined8 uVar3; uVar1 = CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_68_goodB2GData; uVar2 = func_0x00400ba0(&UNK_00401428); if ((uVar2 < uVar1) && (uVar1 < 100)) { uVar3 = func_0x00400c10(uVar1 << 2); func_0x00400be0(uVar3,&UNK_00401428); printWLine(uVar3); func_0x00400b50(uVar3); } else { printLine(&UNK_00401478); } return; }
['gcc']
11,832
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_01_bad() { size_t data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117367/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_01.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_01_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_01_bad(void) { int iVar1; ulong uVar2; undefined auStack_58 [32]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; undefined8 uStack_28; int iStack_1c; int iStack_18; int iStack_14; ulong uStack_10; uStack_10 = 0; iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_58,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_58[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_58,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } uVar2 = func_0x00400d50(&UNK_00401668); if (uVar2 < uStack_10) { uStack_28 = func_0x00400de0(uStack_10 << 2); func_0x00400db0(uStack_28,&UNK_00401668); printWLine(uStack_28); func_0x00400cf0(uStack_28); } else { printLine(&UNK_00401680); } return; }
['gcc']
11,833
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_01_good() { goodG2B(); goodB2G(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117367/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_01.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_01_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_01_good(void) { goodG2B(); goodB2G(); return; }
['gcc']
11,834
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_02_bad() { size_t data; /* Initialize data */ data = 0; if(1) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } if(1) { { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } } }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117368/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_02.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_02_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_02_bad(void) { int iVar1; ulong uVar2; undefined auStack_58 [32]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; undefined8 uStack_28; int iStack_1c; int iStack_18; int iStack_14; ulong uStack_10; uStack_10 = 0; iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_58,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_58[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_58,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } uVar2 = func_0x00400d50(&UNK_00401668); if (uVar2 < uStack_10) { uStack_28 = func_0x00400de0(uStack_10 << 2); func_0x00400db0(uStack_28,&UNK_00401668); printWLine(uStack_28); func_0x00400cf0(uStack_28); } else { printLine(&UNK_00401680); } return; }
['gcc']
11,835
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_02_good() { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117368/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_02.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_02_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_02_good(void) { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); return; }
['gcc']
11,836
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_03_bad() { size_t data; /* Initialize data */ data = 0; if(5==5) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } if(5==5) { { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } } }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117369/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_03.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_03_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_03_bad(void) { int iVar1; ulong uVar2; undefined auStack_58 [32]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; undefined8 uStack_28; int iStack_1c; int iStack_18; int iStack_14; ulong uStack_10; uStack_10 = 0; iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_58,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_58[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_58,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } uVar2 = func_0x00400d50(&UNK_00401668); if (uVar2 < uStack_10) { uStack_28 = func_0x00400de0(uStack_10 << 2); func_0x00400db0(uStack_28,&UNK_00401668); printWLine(uStack_28); func_0x00400cf0(uStack_28); } else { printLine(&UNK_00401680); } return; }
['gcc']
11,837
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_03_good() { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117369/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_03.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_03_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_03_good(void) { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); return; }
['gcc']
11,838
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_04_bad() { size_t data; /* Initialize data */ data = 0; if(STATIC_CONST_TRUE) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } if(STATIC_CONST_TRUE) { { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } } }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117370/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_04.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_04_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_04_bad(void) { int iVar1; ulong uVar2; undefined auStack_58 [32]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; undefined8 uStack_28; int iStack_1c; int iStack_18; int iStack_14; ulong uStack_10; uStack_10 = 0; iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_58,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_58[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_58,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } uVar2 = func_0x00400d50(&UNK_00401680); if (uVar2 < uStack_10) { uStack_28 = func_0x00400de0(uStack_10 << 2); func_0x00400db0(uStack_28,&UNK_00401680); printWLine(uStack_28); func_0x00400cf0(uStack_28); } else { printLine(&UNK_00401698); } return; }
['gcc']
11,839
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_04_good() { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117370/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_04.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_04_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_04_good(void) { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); return; }
['gcc']
11,840
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_05_bad() { size_t data; /* Initialize data */ data = 0; if(staticTrue) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } if(staticTrue) { { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } } }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117371/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_05.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_05_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_05_bad(void) { int iVar1; ulong uVar2; undefined auStack_58 [32]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; undefined8 uStack_28; int iStack_1c; int iStack_18; int iStack_14; ulong uStack_10; uStack_10 = 0; if (staticTrue != 0) { iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_58,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_58[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_58,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } } if (staticTrue != 0) { uVar2 = func_0x00400d50(&UNK_00401678); if (uVar2 < uStack_10) { uStack_28 = func_0x00400de0(uStack_10 << 2); func_0x00400db0(uStack_28,&UNK_00401678); printWLine(uStack_28); func_0x00400cf0(uStack_28); } else { printLine(&UNK_00401690); } } return; }
['gcc']
11,841
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_05_good() { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117371/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_05.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_05_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_05_good(void) { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); return; }
['gcc']
11,842
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_06_bad() { size_t data; /* Initialize data */ data = 0; if(STATIC_CONST_FIVE==5) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } if(STATIC_CONST_FIVE==5) { { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } } }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117372/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_06.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_06_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_06_bad(void) { int iVar1; ulong uVar2; undefined auStack_58 [32]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; undefined8 uStack_28; int iStack_1c; int iStack_18; int iStack_14; ulong uStack_10; uStack_10 = 0; iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_58,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_58[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_58,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } uVar2 = func_0x00400d50(&UNK_0040167c); if (uVar2 < uStack_10) { uStack_28 = func_0x00400de0(uStack_10 << 2); func_0x00400db0(uStack_28,&UNK_0040167c); printWLine(uStack_28); func_0x00400cf0(uStack_28); } else { printLine(&UNK_00401698); } return; }
['gcc']
11,843
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_06_good() { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117372/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_06.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_06_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_06_good(void) { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); return; }
['gcc']
11,844
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_07_bad() { size_t data; /* Initialize data */ data = 0; if(staticFive==5) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } if(staticFive==5) { { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } } }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117373/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_07.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_07_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_07_bad(void) { int iVar1; ulong uVar2; undefined auStack_58 [32]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; undefined8 uStack_28; int iStack_1c; int iStack_18; int iStack_14; ulong uStack_10; uStack_10 = 0; if (staticFive == 5) { iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_58,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_58[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_58,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } } if (staticFive == 5) { uVar2 = func_0x00400d50(&UNK_00401688); if (uVar2 < uStack_10) { uStack_28 = func_0x00400de0(uStack_10 << 2); func_0x00400db0(uStack_28,&UNK_00401688); printWLine(uStack_28); func_0x00400cf0(uStack_28); } else { printLine(&UNK_004016a0); } } return; }
['gcc']
11,845
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_07_good() { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117373/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_07.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_07_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_07_good(void) { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); return; }
['gcc']
11,846
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_08_bad() { size_t data; /* Initialize data */ data = 0; if(staticReturnsTrue()) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } if(staticReturnsTrue()) { { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } } }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117374/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_08.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_08_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_08_bad(void) { int iVar1; ulong uVar2; undefined auStack_58 [32]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; undefined8 uStack_28; int iStack_1c; int iStack_18; int iStack_14; ulong uStack_10; uStack_10 = 0; iVar1 = staticReturnsTrue(); if (iVar1 != 0) { iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_58,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_58[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_58,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } } iVar1 = staticReturnsTrue(); if (iVar1 != 0) { uVar2 = func_0x00400d50(&UNK_00401698); if (uVar2 < uStack_10) { uStack_28 = func_0x00400de0(uStack_10 << 2); func_0x00400db0(uStack_28,&UNK_00401698); printWLine(uStack_28); func_0x00400cf0(uStack_28); } else { printLine(&UNK_004016b0); } } return; }
['gcc']
11,847
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_08_good() { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117374/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_08.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_08_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_08_good(void) { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); return; }
['gcc']
11,848
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_09_bad() { size_t data; /* Initialize data */ data = 0; if(GLOBAL_CONST_TRUE) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } if(GLOBAL_CONST_TRUE) { { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } } }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117375/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_09.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_09_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_09_bad(void) { int iVar1; ulong uVar2; undefined auStack_58 [32]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; undefined8 uStack_28; int iStack_1c; int iStack_18; int iStack_14; ulong uStack_10; uStack_10 = 0; if (GLOBAL_CONST_TRUE != 0) { iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_58,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_58[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_58,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } } if (GLOBAL_CONST_TRUE != 0) { uVar2 = func_0x00400d50(&UNK_00401678); if (uVar2 < uStack_10) { uStack_28 = func_0x00400de0(uStack_10 << 2); func_0x00400db0(uStack_28,&UNK_00401678); printWLine(uStack_28); func_0x00400cf0(uStack_28); } else { printLine(&UNK_00401690); } } return; }
['gcc']
11,849
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_09_good() { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117375/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_09.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_09_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_09_good(void) { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); return; }
['gcc']
11,850
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_10_bad() { size_t data; /* Initialize data */ data = 0; if(globalTrue) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } if(globalTrue) { { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } } }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117376/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_10.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_10_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_10_bad(void) { int iVar1; ulong uVar2; undefined auStack_58 [32]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; undefined8 uStack_28; int iStack_1c; int iStack_18; int iStack_14; ulong uStack_10; uStack_10 = 0; if (globalTrue != 0) { iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_58,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_58[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_58,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } } if (globalTrue != 0) { uVar2 = func_0x00400d50(&UNK_00401678); if (uVar2 < uStack_10) { uStack_28 = func_0x00400de0(uStack_10 << 2); func_0x00400db0(uStack_28,&UNK_00401678); printWLine(uStack_28); func_0x00400cf0(uStack_28); } else { printLine(&UNK_00401690); } } return; }
['gcc']
11,851
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_10_good() { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117376/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_10.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_10_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_10_good(void) { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); return; }
['gcc']
11,852
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_11_bad() { size_t data; /* Initialize data */ data = 0; if(globalReturnsTrue()) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } if(globalReturnsTrue()) { { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } } }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117377/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_11.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_11_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_11_bad(void) { int iVar1; ulong uVar2; undefined auStack_58 [32]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; undefined8 uStack_28; int iStack_1c; int iStack_18; int iStack_14; ulong uStack_10; uStack_10 = 0; iVar1 = globalReturnsTrue(); if (iVar1 != 0) { iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_58,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_58[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_58,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } } iVar1 = globalReturnsTrue(); if (iVar1 != 0) { uVar2 = func_0x00400d50(&UNK_00401688); if (uVar2 < uStack_10) { uStack_28 = func_0x00400de0(uStack_10 << 2); func_0x00400db0(uStack_28,&UNK_00401688); printWLine(uStack_28); func_0x00400cf0(uStack_28); } else { printLine(&UNK_004016a0); } } return; }
['gcc']
11,853
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_11_good() { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117377/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_11.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_11_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_11_good(void) { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); return; }
['gcc']
11,854
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_12_bad() { size_t data; /* Initialize data */ data = 0; if(globalReturnsTrueOrFalse()) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } else { /* FIX: Use a relatively small number for memory allocation */ data = 20; } if(globalReturnsTrueOrFalse()) { { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } } else { { wchar_t * myString; /* FIX: Include a MAXIMUM limitation for memory allocation and a check to ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING) && data < 100) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string or too large"); } } } }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* FIX: Use a relatively small number for memory allocation */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */', '/* FIX: Include a MAXIMUM limitation for memory allocation and a check to ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117378/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_12.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_12_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_12_bad(void) { int iVar1; ulong uVar2; undefined auStack_68 [32]; undefined2 uStack_48; undefined2 uStack_46; undefined4 uStack_44; undefined8 uStack_30; undefined8 uStack_28; int iStack_1c; int iStack_18; int iStack_14; ulong uStack_10; uStack_10 = 0; iVar1 = globalReturnsTrueOrFalse(); if (iVar1 == 0) { uStack_10 = 0x14; } else { iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_48,0,0x10); uStack_48 = 2; uStack_44 = 0; uStack_46 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_48,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_68,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_68[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_68,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } } iVar1 = globalReturnsTrueOrFalse(); if (iVar1 == 0) { uVar2 = func_0x00400d50(&UNK_004016f8); if ((uVar2 < uStack_10) && (uStack_10 < 100)) { uStack_28 = func_0x00400de0(uStack_10 << 2); func_0x00400db0(uStack_28,&UNK_004016f8); printWLine(uStack_28); func_0x00400cf0(uStack_28); } else { printLine(&UNK_00401748); } } else { uVar2 = func_0x00400d50(&UNK_004016f8); if (uVar2 < uStack_10) { uStack_30 = func_0x00400de0(uStack_10 << 2); func_0x00400db0(uStack_30,&UNK_004016f8); printWLine(uStack_30); func_0x00400cf0(uStack_30); } else { printLine(&UNK_00401710); } } return; }
['gcc']
11,855
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_12_good() { goodB2G(); goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117378/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_12.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_12_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_12_good(void) { goodB2G(); goodG2B(); return; }
['gcc']
11,856
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_13_bad() { size_t data; /* Initialize data */ data = 0; if(GLOBAL_CONST_FIVE==5) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } if(GLOBAL_CONST_FIVE==5) { { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } } }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117379/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_13.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_13_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_13_bad(void) { int iVar1; ulong uVar2; undefined auStack_58 [32]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; undefined8 uStack_28; int iStack_1c; int iStack_18; int iStack_14; ulong uStack_10; uStack_10 = 0; if (GLOBAL_CONST_FIVE == 5) { iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_58,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_58[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_58,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } } if (GLOBAL_CONST_FIVE == 5) { uVar2 = func_0x00400d50(&UNK_00401688); if (uVar2 < uStack_10) { uStack_28 = func_0x00400de0(uStack_10 << 2); func_0x00400db0(uStack_28,&UNK_00401688); printWLine(uStack_28); func_0x00400cf0(uStack_28); } else { printLine(&UNK_004016a0); } } return; }
['gcc']
11,857
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_13_good() { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117379/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_13.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_13_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_13_good(void) { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); return; }
['gcc']
11,858
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_14_bad() { size_t data; /* Initialize data */ data = 0; if(globalFive==5) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } if(globalFive==5) { { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } } }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117380/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_14.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_14_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_14_bad(void) { int iVar1; ulong uVar2; undefined auStack_58 [32]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; undefined8 uStack_28; int iStack_1c; int iStack_18; int iStack_14; ulong uStack_10; uStack_10 = 0; if (globalFive == 5) { iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_58,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_58[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_58,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } } if (globalFive == 5) { uVar2 = func_0x00400d50(&UNK_00401688); if (uVar2 < uStack_10) { uStack_28 = func_0x00400de0(uStack_10 << 2); func_0x00400db0(uStack_28,&UNK_00401688); printWLine(uStack_28); func_0x00400cf0(uStack_28); } else { printLine(&UNK_004016a0); } } return; }
['gcc']
11,859
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_14_good() { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117380/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_14.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_14_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_14_good(void) { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); return; }
['gcc']
11,860
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_15_bad() { size_t data; /* Initialize data */ data = 0; switch(6) { case 6: { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } break; default: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); break; } switch(7) { case 7: { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } break; default: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); break; } }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */', '/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117381/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_15.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_15_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_15_bad(void) { int iVar1; ulong uVar2; undefined auStack_58 [32]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; undefined8 uStack_28; int iStack_1c; int iStack_18; int iStack_14; ulong uStack_10; uStack_10 = 0; iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_58,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_58[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_58,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } uVar2 = func_0x00400d50(&UNK_00401668); if (uVar2 < uStack_10) { uStack_28 = func_0x00400de0(uStack_10 << 2); func_0x00400db0(uStack_28,&UNK_00401668); printWLine(uStack_28); func_0x00400cf0(uStack_28); } else { printLine(&UNK_00401680); } return; }
['gcc']
11,861
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_15_good() { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117381/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_15.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_15_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_15_good(void) { goodB2G1(); goodB2G2(); goodG2B1(); goodG2B2(); return; }
['gcc']
11,862
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_16_bad() { size_t data; /* Initialize data */ data = 0; while(1) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } break; } while(1) { { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } break; } }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117382/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_16.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_16_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_16_bad(void) { int iVar1; ulong uVar2; undefined auStack_58 [32]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; undefined8 uStack_28; int iStack_1c; int iStack_18; int iStack_14; ulong uStack_10; uStack_10 = 0; iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_58,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_58[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_58,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } uVar2 = func_0x00400d50(&UNK_00401668); if (uVar2 < uStack_10) { uStack_28 = func_0x00400de0(uStack_10 << 2); func_0x00400db0(uStack_28,&UNK_00401668); printWLine(uStack_28); func_0x00400cf0(uStack_28); } else { printLine(&UNK_00401680); } return; }
['gcc']
11,863
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_16_good() { goodB2G(); goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117382/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_16.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_16_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_16_good(void) { goodB2G(); goodG2B(); return; }
['gcc']
11,864
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_17_bad() { int i,j; size_t data; /* Initialize data */ data = 0; for(i = 0; i < 1; i++) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } for(j = 0; j < 1; j++) { { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } } }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117383/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_17.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_17_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_17_bad(void) { int iVar1; ulong uVar2; undefined auStack_68 [32]; undefined2 uStack_48; undefined2 uStack_46; undefined4 uStack_44; int iStack_30; int iStack_2c; undefined8 uStack_28; int iStack_1c; ulong uStack_18; int iStack_10; int iStack_c; uStack_18 = 0; for (iStack_c = 0; iStack_c < 1; iStack_c = iStack_c + 1) { iStack_2c = 0xffffffff; iStack_1c = -1; iStack_2c = func_0x00400e70(2,1,6); if (iStack_2c != -1) { func_0x00400d60(&uStack_48,0,0x10); uStack_48 = 2; uStack_44 = 0; uStack_46 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_2c,&uStack_48,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_2c,5), iVar1 != -1)) && (iStack_1c = func_0x00400e30(iStack_2c,0,0), iStack_1c != -1)) && ((iStack_30 = func_0x00400d00(iStack_1c,auStack_68,0x19,0), iStack_30 != -1 && (iStack_30 != 0)))) { auStack_68[iStack_30] = 0; uStack_18 = func_0x00400e40(auStack_68,0,0); } } if (iStack_2c != -1) { func_0x00400d70(iStack_2c); } if (iStack_1c != -1) { func_0x00400d70(iStack_1c); } } for (iStack_10 = 0; iStack_10 < 1; iStack_10 = iStack_10 + 1) { uVar2 = func_0x00400d50(&UNK_00401698); if (uVar2 < uStack_18) { uStack_28 = func_0x00400de0(uStack_18 << 2); func_0x00400db0(uStack_28,&UNK_00401698); printWLine(uStack_28); func_0x00400cf0(uStack_28); } else { printLine(&UNK_004016b0); } } return; }
['gcc']
11,865
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_17_good() { goodB2G(); goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117383/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_17.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_17_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_17_good(void) { goodB2G(); goodG2B(); return; }
['gcc']
11,866
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_18_bad() { size_t data; /* Initialize data */ data = 0; goto source; source: { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } goto sink; sink: { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117384/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_18.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_18_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_18_bad(void) { int iVar1; ulong uVar2; undefined auStack_58 [32]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; undefined8 uStack_28; int iStack_1c; int iStack_18; int iStack_14; ulong uStack_10; uStack_10 = 0; iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_58,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_58[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_58,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } uVar2 = func_0x00400d50(&UNK_00401668); if (uVar2 < uStack_10) { uStack_28 = func_0x00400de0(uStack_10 << 2); func_0x00400db0(uStack_28,&UNK_00401668); printWLine(uStack_28); func_0x00400cf0(uStack_28); } else { printLine(&UNK_00401680); } return; }
['gcc']
11,867
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_18_good() { goodB2G(); goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117384/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_18.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_18_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_18_good(void) { goodB2G(); goodG2B(); return; }
['gcc']
11,868
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_21_bad() { size_t data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } badStatic = 1; /* true */ badSink(data); }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* true */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117385/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_21.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_21_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_21_bad(void) { int iVar1; undefined auStack_58 [32]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; undefined8 uStack_10; uStack_10 = 0; iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_58,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_58[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_58,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } badStatic = 1; badSink(uStack_10); return; }
['gcc']
11,869
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_21_good() { goodB2G1(); goodB2G2(); goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117385/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_21.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_21_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_21_good(void) { goodB2G1(); goodB2G2(); goodG2B(); return; }
['gcc']
11,870
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_bad() { size_t data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_badGlobal = 1; /* true */ CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_badSink(data); }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* true */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117386/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22a.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_bad(void) { int iVar1; undefined auStack_58 [32]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; undefined8 uStack_10; uStack_10 = 0; iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_58,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_58[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_58,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_badGlobal = 1; CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_badSink(uStack_10); return; }
['gcc']
11,871
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_good() { goodB2G1(); goodB2G2(); goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117386/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22a.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_good(void) { goodB2G1(); goodB2G2(); goodG2B(); return; }
['gcc']
11,872
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_badSink(size_t data) { if(CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_badGlobal) { { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } } }
['/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117386/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_badSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_badSink(ulong param_1) { ulong uVar1; undefined8 uVar2; if (CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_badGlobal != 0) { uVar1 = func_0x00400d50(&UNK_00401698); if (uVar1 < param_1) { uVar2 = func_0x00400de0(param_1 << 2); func_0x00400db0(uVar2,&UNK_00401698); printWLine(uVar2); func_0x00400cf0(uVar2); } else { printLine(&UNK_004016b0); } } return; }
['gcc']
11,873
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_goodB2G1Sink(size_t data) { if(CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_goodB2G1Global) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { { wchar_t * myString; /* FIX: Include a MAXIMUM limitation for memory allocation and a check to ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING) && data < 100) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string or too large"); } } } }
['/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */', '/* FIX: Include a MAXIMUM limitation for memory allocation and a check to ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117386/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_goodB2G1Sink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_goodB2G1Sink(ulong param_1) { ulong uVar1; undefined8 uVar2; if (CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_goodB2G1Global == 0) { uVar1 = func_0x00400d50(&UNK_00401950); if ((uVar1 < param_1) && (param_1 < 100)) { uVar2 = func_0x00400de0(param_1 << 2); func_0x00400db0(uVar2,&UNK_00401950); printWLine(uVar2); func_0x00400cf0(uVar2); } else { printLine(&UNK_00401968); } } else { printLine(&UNK_00401938); } return; }
['gcc']
11,874
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_goodB2G2Sink(size_t data) { if(CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_goodB2G2Global) { { wchar_t * myString; /* FIX: Include a MAXIMUM limitation for memory allocation and a check to ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING) && data < 100) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string or too large"); } } } }
['/* FIX: Include a MAXIMUM limitation for memory allocation and a check to ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117386/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_goodB2G2Sink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_goodB2G2Sink(ulong param_1) { ulong uVar1; undefined8 uVar2; if (CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_goodB2G2Global != 0) { uVar1 = func_0x00400d50(&UNK_00401950); if ((uVar1 < param_1) && (param_1 < 100)) { uVar2 = func_0x00400de0(param_1 << 2); func_0x00400db0(uVar2,&UNK_00401950); printWLine(uVar2); func_0x00400cf0(uVar2); } else { printLine(&UNK_00401968); } } return; }
['gcc']
11,875
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_goodG2BSink(size_t data) { if(CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_goodG2BGlobal) { { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } } }
['/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117386/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_goodG2BSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_goodG2BSink(ulong param_1) { ulong uVar1; undefined8 uVar2; if (CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_22_goodG2BGlobal != 0) { uVar1 = func_0x00400d50(&UNK_00401950); if (uVar1 < param_1) { uVar2 = func_0x00400de0(param_1 << 2); func_0x00400db0(uVar2,&UNK_00401950); printWLine(uVar2); func_0x00400cf0(uVar2); } else { printLine(&UNK_004019a8); } } return; }
['gcc']
11,876
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_31_bad() { size_t data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } { size_t dataCopy = data; size_t data = dataCopy; { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } } }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117387/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_31.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_31_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_31_bad(void) { int iVar1; ulong uVar2; undefined auStack_68 [32]; undefined2 uStack_48; undefined2 uStack_46; undefined4 uStack_44; undefined8 uStack_38; ulong uStack_30; ulong uStack_28; int iStack_1c; int iStack_18; int iStack_14; ulong uStack_10; uStack_10 = 0; iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_48,0,0x10); uStack_48 = 2; uStack_44 = 0; uStack_46 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_48,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_68,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_68[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_68,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } uStack_28 = uStack_10; uStack_30 = uStack_10; uVar2 = func_0x00400d50(&UNK_00401678); if (uVar2 < uStack_30) { uStack_38 = func_0x00400de0(uStack_30 << 2); func_0x00400db0(uStack_38,&UNK_00401678); printWLine(uStack_38); func_0x00400cf0(uStack_38); } else { printLine(&UNK_00401690); } return; }
['gcc']
11,877
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_31_good() { goodG2B(); goodB2G(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117387/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_31.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_31_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_31_good(void) { goodG2B(); goodB2G(); return; }
['gcc']
11,878
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_32_bad() { size_t data; size_t *dataPtr1 = &data; size_t *dataPtr2 = &data; /* Initialize data */ data = 0; { size_t data = *dataPtr1; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } *dataPtr1 = data; } { size_t data = *dataPtr2; { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } } }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117388/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_32.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_32_bad
/* WARNING: Restarted to delay deadcode elimination for space: stack */ void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_32_bad(void) { int iVar1; ulong uVar2; undefined auStack_78 [32]; undefined2 uStack_58; undefined2 uStack_56; undefined4 uStack_54; ulong uStack_48; undefined8 uStack_40; ulong uStack_38; int iStack_30; int iStack_2c; ulong *puStack_28; ulong *puStack_20; int iStack_14; ulong uStack_10; puStack_20 = &uStack_48; puStack_28 = &uStack_48; uStack_48 = 0; uStack_10 = 0; iStack_2c = 0xffffffff; iStack_14 = -1; iStack_2c = func_0x00400e70(2,1,6); if (iStack_2c != -1) { func_0x00400d60(&uStack_58,0,0x10); uStack_58 = 2; uStack_54 = 0; uStack_56 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_2c,&uStack_58,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_2c,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_2c,0,0), iStack_14 != -1)) && ((iStack_30 = func_0x00400d00(iStack_14,auStack_78,0x19,0), iStack_30 != -1 && (iStack_30 != 0)))) { auStack_78[iStack_30] = 0; uStack_10 = func_0x00400e40(auStack_78,0,0); } } if (iStack_2c != -1) { func_0x00400d70(iStack_2c); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } *puStack_20 = uStack_10; uStack_38 = *puStack_28; uVar2 = func_0x00400d50(&UNK_00401698); if (uVar2 < uStack_38) { uStack_40 = func_0x00400de0(uStack_38 << 2); func_0x00400db0(uStack_40,&UNK_00401698); printWLine(uStack_40); func_0x00400cf0(uStack_40); } else { printLine(&UNK_004016b0); } return; }
['gcc']
11,879
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_32_good() { goodG2B(); goodB2G(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117388/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_32.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_32_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_32_good(void) { goodG2B(); goodB2G(); return; }
['gcc']
11,880
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_34_bad() { size_t data; CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_34_unionType myUnion; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } 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; { size_t data = myUnion.unionSecond; { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } } }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117390/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_34.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_34_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_34_bad(void) { int iVar1; ulong uVar2; undefined auStack_68 [32]; undefined2 uStack_48; undefined2 uStack_46; undefined4 uStack_44; ulong uStack_38; undefined8 uStack_30; ulong uStack_28; int iStack_1c; int iStack_18; int iStack_14; ulong uStack_10; uStack_10 = 0; iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_48,0,0x10); uStack_48 = 2; uStack_44 = 0; uStack_46 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_48,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_68,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_68[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_68,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } uStack_38 = uStack_10; uStack_28 = uStack_10; uVar2 = func_0x00400d50(&UNK_00401678); if (uVar2 < uStack_28) { uStack_30 = func_0x00400de0(uStack_28 << 2); func_0x00400db0(uStack_30,&UNK_00401678); printWLine(uStack_30); func_0x00400cf0(uStack_30); } else { printLine(&UNK_00401690); } return; }
['gcc']
11,881
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_34_good() { goodG2B(); goodB2G(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117390/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_34.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_34_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_34_good(void) { goodG2B(); goodB2G(); return; }
['gcc']
11,882
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_41_bad() { size_t data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } badSink(data); }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117391/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_41.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_41_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_41_bad(void) { int iVar1; undefined auStack_58 [32]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; undefined8 uStack_10; uStack_10 = 0; iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_58,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_58[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_58,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } badSink(uStack_10); return; }
['gcc']
11,883
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_41_good() { goodB2G(); goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117391/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_41.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_41_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_41_good(void) { goodB2G(); goodG2B(); return; }
['gcc']
11,884
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_42_bad() { size_t data; /* Initialize data */ data = 0; data = badSource(data); { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } }
['/* Initialize data */', '/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117392/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_42.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_42_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_42_bad(void) { ulong uVar1; ulong uVar2; undefined8 uVar3; uVar1 = badSource(0); uVar2 = func_0x00400d50(&UNK_00401688); if (uVar2 < uVar1) { uVar3 = func_0x00400de0(uVar1 << 2); func_0x00400db0(uVar3,&UNK_00401688); printWLine(uVar3); func_0x00400cf0(uVar3); } else { printLine(&UNK_004016a0); } return; }
['gcc']
11,885
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_42_good() { goodB2G(); goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117392/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_42.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_42_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_42_good(void) { goodB2G(); goodG2B(); return; }
['gcc']
11,886
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_44_bad() { size_t data; /* define a function pointer */ void (*funcPtr) (size_t) = badSink; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } 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 */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */', '/* use the function pointer */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117394/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_44.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_44_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_44_bad(void) { int iVar1; undefined auStack_58 [32]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_28; int iStack_24; code *pcStack_20; int iStack_14; undefined8 uStack_10; pcStack_20 = badSink; uStack_10 = 0; iStack_24 = 0xffffffff; iStack_14 = -1; iStack_24 = func_0x00400e70(2,1,6); if (iStack_24 != -1) { func_0x00400d60(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_24,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_24,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_24,0,0), iStack_14 != -1)) && ((iStack_28 = func_0x00400d00(iStack_14,auStack_58,0x19,0), iStack_28 != -1 && (iStack_28 != 0)))) { auStack_58[iStack_28] = 0; uStack_10 = func_0x00400e40(auStack_58,0,0); } } if (iStack_24 != -1) { func_0x00400d70(iStack_24); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } (*pcStack_20)(uStack_10); return; }
['gcc']
11,887
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_44_good() { goodG2B(); goodB2G(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117394/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_44.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_44_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_44_good(void) { goodG2B(); goodB2G(); return; }
['gcc']
11,888
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_45_bad() { size_t data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_45_badData = data; badSink(); }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117395/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_45.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_45_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_45_bad(void) { int iVar1; undefined auStack_58 [32]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; undefined8 uStack_10; uStack_10 = 0; iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_58,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_58[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_58,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_45_badData = uStack_10; badSink(); return; }
['gcc']
11,889
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_45_good() { goodG2B(); goodB2G(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117395/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_45.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_45_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_45_good(void) { goodG2B(); goodB2G(); return; }
['gcc']
11,890
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_51_bad() { size_t data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_51b_badSink(data); }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117396/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_51a.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_51_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_51_bad(void) { int iVar1; undefined auStack_58 [32]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; undefined8 uStack_10; uStack_10 = 0; iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_58,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_58[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_58,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_51b_badSink(uStack_10); return; }
['gcc']
11,891
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_51_good() { goodG2B(); goodB2G(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117396/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_51a.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_51_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_51_good(void) { goodG2B(); goodB2G(); return; }
['gcc']
11,892
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_51b_badSink(size_t data) { { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } }
['/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117396/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_51b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_51b_badSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_51b_badSink(ulong param_1) { ulong uVar1; undefined8 uVar2; uVar1 = func_0x00400d50(&UNK_00401688); if (uVar1 < param_1) { uVar2 = func_0x00400de0(param_1 << 2); func_0x00400db0(uVar2,&UNK_00401688); printWLine(uVar2); func_0x00400cf0(uVar2); } else { printLine(&UNK_004016a0); } return; }
['gcc']
11,893
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_51b_goodG2BSink(size_t data) { { wchar_t * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING)) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } }
['/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117396/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_51b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_51b_goodG2BSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_51b_goodG2BSink(ulong param_1) { ulong uVar1; undefined8 uVar2; uVar1 = func_0x00400d50(&UNK_00401738); if (uVar1 < param_1) { uVar2 = func_0x00400de0(param_1 << 2); func_0x00400db0(uVar2,&UNK_00401738); printWLine(uVar2); func_0x00400cf0(uVar2); } else { printLine(&UNK_00401750); } return; }
['gcc']
11,894
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_51b_goodB2GSink(size_t data) { { wchar_t * myString; /* FIX: Include a MAXIMUM limitation for memory allocation and a check to ensure data is large enough * for the wcscpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > wcslen(HELLO_STRING) && data < 100) { myString = (wchar_t *)malloc(data*sizeof(wchar_t)); /* Copy a small string into myString */ wcscpy(myString, HELLO_STRING); printWLine(myString); free(myString); } else { printLine("Input is less than the length of the source string or too large"); } } }
['/* FIX: Include a MAXIMUM limitation for memory allocation and a check to ensure data is large enough\r\n * for the wcscpy() function to not cause a buffer overflow */', '/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */', '/* Copy a small string into myString */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117396/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_51b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_51b_goodB2GSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_51b_goodB2GSink(ulong param_1) { ulong uVar1; undefined8 uVar2; uVar1 = func_0x00400d50(&UNK_00401738); if ((uVar1 < param_1) && (param_1 < 100)) { uVar2 = func_0x00400de0(param_1 << 2); func_0x00400db0(uVar2,&UNK_00401738); printWLine(uVar2); func_0x00400cf0(uVar2); } else { printLine(&UNK_00401788); } return; }
['gcc']
11,895
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52_bad() { size_t data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; 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 /* POTENTIAL FLAW: Read data using a listen socket */ 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); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52b_badSink(data); }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to unsigned int */']
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117397/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52a.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52_bad
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52_bad(void) { int iVar1; undefined auStack_58 [32]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_1c; int iStack_18; int iStack_14; undefined8 uStack_10; uStack_10 = 0; iStack_18 = 0xffffffff; iStack_14 = -1; iStack_18 = func_0x00400e70(2,1,6); if (iStack_18 != -1) { func_0x00400d60(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400d30(0x6987); iVar1 = func_0x00400e20(iStack_18,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400e10(iStack_18,5), iVar1 != -1)) && (iStack_14 = func_0x00400e30(iStack_18,0,0), iStack_14 != -1)) && ((iStack_1c = func_0x00400d00(iStack_14,auStack_58,0x19,0), iStack_1c != -1 && (iStack_1c != 0)))) { auStack_58[iStack_1c] = 0; uStack_10 = func_0x00400e40(auStack_58,0,0); } } if (iStack_18 != -1) { func_0x00400d70(iStack_18); } if (iStack_14 != -1) { func_0x00400d70(iStack_14); } CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52b_badSink(uStack_10); return; }
['gcc']
11,896
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52_good() { goodG2B(); goodB2G(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117397/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52a.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52_good
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52_good(void) { goodG2B(); goodB2G(); return; }
['gcc']
11,897
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52b_badSink(size_t data) { CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52c_badSink(data); }
[]
['CWE789']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117397/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52b_badSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52b_badSink(undefined8 param_1) { CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52c_badSink(param_1); return; }
['gcc']
11,898
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52b_goodG2BSink(size_t data) { CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52c_goodG2BSink(data); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117397/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52b_goodG2BSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52b_goodG2BSink(undefined8 param_1) { CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52c_goodG2BSink(param_1); return; }
['gcc']
11,899
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52b_goodB2GSink(size_t data) { CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52c_goodB2GSink(data); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/117397/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52b.c
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52b_goodB2GSink
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52b_goodB2GSink(undefined8 param_1) { CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_52c_goodB2GSink(param_1); return; }
['gcc']