source stringclasses 3
values | language stringclasses 1
value | cwe_id stringclasses 113
values | severity stringclasses 4
values | buggy_code stringlengths 20 7.76k ⌀ | fixed_code stringclasses 350
values | clean_code stringlengths 16 10.4k ⌀ | explanation stringclasses 290
values | is_buggy bool 2
classes | bug_lines listlengths 0 2 | function stringlengths 5 94 | repo stringclasses 18
values | id stringlengths 10 10 | split stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
juliet | C | CWE-191 | LOW | null | null | {
/* FIX: Add a check to prevent an underflow from occurring */
if (data > 0)
{
--data;
unsigned int result = data;
printUnsignedLine(result);
}
else
{
printLine("data value is too large to perform arithmetic safely.");
}
} | Integer underflow. An arithmetic operation produces a result below the minimum value. | false | [] | goodB2GSink | NIST/juliet | JUL_002355 | train |
juliet | C | CWE-122 | HIGH | {
int * data;
data = NULL;
data = badSource(data);
{
int source[10] = {0};
size_t i;
/* POTENTIAL FLAW: Possible buffer overflow if data was not allocated correctly in the source */
for (i = 0; i < 10; i++)
{
data[i] = source[i];
}
prin... | null | null | Heap-based buffer overflow. The code writes past the end of a heap-allocated buffer, corrupting heap metadata or adjacent allocations. | true | [] | CWE122_Heap_Based_Buffer_Overflow__CWE131_loop_42_bad | NIST/juliet | JUL_000585 | train |
juliet | C | CWE-467 | LOW | null | null | {
good1();
good2();
} | This code contains a software defect (CWE-467). Review carefully for memory safety issues. | false | [] | CWE467_Use_of_sizeof_on_Pointer_Type__short_09_good | NIST/juliet | JUL_009444 | train |
linux_kernel | C | CWE-190 | MEDIUM | // ...
#define seamcall(_fn, _args) sc_retry(__seamcall, (_fn), (_args))
#define seamcall_ret(_fn, _args) sc_retry(__seamcall_ret, (_fn), (_args))
#define seamcall_saved_ret(_fn, _args) sc_retry(__seamcall_saved_ret, (_fn), (_args))
int tdx_cpu_enable(void);
int tdx_enable(void);
const char *tdx_dump_mce_info(struct m... | // ...
#define seamcall(_fn, _args) sc_retry(__seamcall, (_fn), (_args))
#define seamcall_ret(_fn, _args) sc_retry(__seamcall_ret, (_fn), (_args))
#define seamcall_saved_ret(_fn, _args) sc_retry(__seamcall_saved_ret, (_fn), (_args))
const char *tdx_dump_mce_info(struct mce *m);
const struct tdx_sys_info *tdx_get_sysin... | null | Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull kvm updates from Paolo Bonzini:
"Arm:
- Add support for tracing in the standalone EL2 hypervisor code,
which should help both debugging and performance analysis. This
uses the new infrastructure for 'remote' trace buffers that can b... | true | [] | arch/x86/include/asm/tdx.h | torvalds/linux | LIN_016932 | train |
juliet | C | CWE-773 | LOW | null | null | {
FILE * data;
data = NULL;
/* POTENTIAL FLAW: Create a file handle using fopen() that may not be closed properly */
data = fopen("BadSource_fopen.txt", "w+");
CWE773_Missing_Reference_to_Active_File_Descriptor_or_Handle__fopen_54b_goodB2GSink(data);
} | This code contains a software defect (CWE-773). Review carefully for memory safety issues. | false | [] | goodB2G | NIST/juliet | JUL_015138 | train |
juliet | C | CWE-506 | LOW | {
if(GLOBAL_CONST_FIVE==5)
{
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
struct sockaddr_in service;
SOCKET connectSocket = INVALID_SOCKET;
char contents[65536]; /* Assume file contents is less than 65k to make this test case e... | null | null | This code contains a defect classified under CWE506 (Embedded Malicious Code). The _bad variant demonstrates the vulnerability; good variants show the correct implementation. | true | [
86
] | CWE506_Embedded_Malicious_Code__file_transfer_connect_socket_13_bad | NIST/juliet | JUL_010838 | train |
juliet | C | CWE-506 | LOW | {
while(1)
{
{
/* adapted from http://msdn.microsoft.com/en-us/library/dd183402 */
HDC hdcWindow = NULL;
HDC hdcMemDC = NULL;
HBITMAP hbmScreen = NULL;
HGDIOBJ selectResult = NULL;
BITMAP bmpScreen;
RECT rcClient;
... | null | null | This code contains a defect classified under CWE506 (Embedded Malicious Code). The _bad variant demonstrates the vulnerability; good variants show the correct implementation. | true | [
146
] | CWE506_Embedded_Malicious_Code__w32_screen_capture_16_bad | NIST/juliet | JUL_010850 | train |
juliet | C | CWE-325 | LOW | null | null | {
if(staticReturnsTrue())
{
{
BYTE payload[100];
DWORD payloadLen = strlen(PAYLOAD);
HCRYPTPROV hCryptProv = (HCRYPTPROV)NULL;
HCRYPTHASH hHash = (HCRYPTHASH)NULL;
HCRYPTKEY hKey = (HCRYPTKEY)NULL;
char hashData[100] = HASH_INPUT;
... | This code contains a software defect (CWE-325). Review carefully for memory safety issues. | false | [] | good2 | NIST/juliet | JUL_005662 | train |
linux_kernel | C | CWE-476 | MEDIUM | // ...
const struct ksz_dev_ops *ops = port->ksz_dev->dev_ops;
struct ksz_irq *ptpirq = &port->ptpirq;
struct ksz_ptp_irq *ptpmsg_irq;
ptpmsg_irq = &port->ptpmsg_irq[n];
ptpmsg_irq->num = irq_create_mapping(ptpirq->domain, n);
// ...
strscpy(ptpmsg_irq->name, name[n]);
return request_threaded_irq(ptpmsg_irq->... | // ...
const struct ksz_dev_ops *ops = port->ksz_dev->dev_ops;
struct ksz_irq *ptpirq = &port->ptpirq;
struct ksz_ptp_irq *ptpmsg_irq;
int ret;
ptpmsg_irq = &port->ptpmsg_irq[n];
ptpmsg_irq->num = irq_create_mapping(ptpirq->domain, n);
// ...
strscpy(ptpmsg_irq->name, name[n]);
ret = request_threaded_irq(ptp... | null | Merge tag 'net-7.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from Paolo Abeni:
"Including fixes from CAN and netfilter.
Current release - regressions:
- eth: mana: Null service_wq on setup error to prevent double destroy
Previous releases - regressions:
- nex... | true | [] | drivers/net/dsa/microchip/ksz_ptp.c | torvalds/linux | LIN_016699 | train |
juliet | C | CWE-459 | LOW | {
switch(6)
{
case 6:
{
wchar_t * filename;
wchar_t tmpl[] = L"badXXXXXX";
FILE *pFile;
/* Establish that this is a temporary file and that it should be deleted */
filename = MKTEMP(tmpl);
if (filename != NULL)
{
pFile = FOPEN(filename,... | null | null | This code contains a defect classified under CWE459 (Incomplete Cleanup). The _bad variant demonstrates the vulnerability; good variants show the correct implementation. | true | [
48
] | CWE459_Incomplete_Cleanup__wchar_t_15_bad | NIST/juliet | JUL_009179 | train |
juliet | C | CWE-590 | LOW | null | null | {
twoIntsStruct * data;
data = NULL; /* Initialize data */
if(staticTrue)
{
{
/* FIX: data is allocated on the heap and deallocated in the BadSink */
twoIntsStruct * dataBuffer = (twoIntsStruct *)malloc(100*sizeof(twoIntsStruct));
if (dataBuffer == NULL)
... | This code contains a software defect (CWE-590). Review carefully for memory safety issues. | false | [] | goodG2B2 | NIST/juliet | JUL_012446 | train |
juliet | C | CWE-666 | LOW | null | null | {
good1();
good2();
} | This code contains a software defect (CWE-666). Review carefully for memory safety issues. | false | [] | CWE666_Operation_on_Resource_in_Wrong_Phase_of_Lifetime__accept_listen_bind_09_good | NIST/juliet | JUL_013536 | train |
juliet | C | CWE-588 | LOW | null | null | {
void * data;
twoIntsStruct dataGoodBuffer;
int dataBadBuffer = 100;
dataGoodBuffer.intOne = 0;
dataGoodBuffer.intTwo = 0;
/* FIX: Set data to point to a twoIntsStruct struct */
data = &dataGoodBuffer;
{
void * dataCopy = data;
void * data = dataCopy;
/* POTENTIA... | This code contains a software defect (CWE-588). Review carefully for memory safety issues. | false | [] | goodG2B | NIST/juliet | JUL_012255 | train |
juliet | C | CWE-464 | LOW | null | null | {
char data;
data = ' ';
if(globalTrue)
{
/* FIX: Set data to be a char */
data = 'a';
}
{
char charArraySink[4];
charArraySink[0] = 'x';
/* POTENTIAL FLAW: If data is null, the rest of the array will not be printed */
charArraySink[1] = data;
... | This code contains a software defect (CWE-464). Review carefully for memory safety issues. | false | [] | goodG2B2 | NIST/juliet | JUL_009319 | train |
juliet | C | CWE-273 | LOW | {
if(staticFive==5)
{
{
HANDLE hPipe = INVALID_HANDLE_VALUE;
hPipe = CreateNamedPipeA(
"\\\\.\\pipe\\test_pipe",
PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE,
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE |... | null | null | This code contains a defect classified under CWE273 (Improper Check for Dropped Privileges). The _bad variant demonstrates the vulnerability; good variants show the correct implementation. | true | [
55
] | CWE273_Improper_Check_for_Dropped_Privileges__w32_ImpersonateNamedPipeClient_07_bad | NIST/juliet | JUL_004879 | train |
juliet | C | CWE-190 | LOW | null | null | {
unsigned int data;
void (*funcPtr) (unsigned int) = goodB2GSink;
data = 0;
/* POTENTIAL FLAW: Use a value input from the console */
fscanf (stdin, "%u", &data);
funcPtr(data);
} | Integer overflow. An arithmetic operation exceeds the maximum value for the data type. | false | [] | goodB2G | NIST/juliet | JUL_002237 | train |
juliet | C | CWE-535 | LOW | {
if(STATIC_CONST_TRUE)
{
{
char password[100] = "";
size_t passwordLen = 0;
HANDLE pHandle;
char * username = "User";
char * domain = "Domain";
if (fgets(password, 100, stdin) == NULL)
{
printLine("fgets... | null | null | This code contains a defect classified under CWE535 (Info Exposure Shell Error). The _bad variant demonstrates the vulnerability; good variants show the correct implementation. | true | [
68
] | CWE535_Info_Exposure_Shell_Error__w32_char_04_bad | NIST/juliet | JUL_011469 | train |
linux_kernel | C | CWE-unknown | LOW | // ...
al->offset = args->offset;
al->line = strdup(args->line);
al->line_nr = args->line_nr;
al->fileloc = args->fileloc;
al->data_nr = nr;
}
static void annotation_line__exit(struct annotation_line *al)
{
zfree_srcline(&al->path);
zfree(&al->line);
zfree(&al->cycles);
zfree(&al->br_cntr);
// ...
annotatio... | // ...
al->offset = args->offset;
al->line = strdup(args->line);
al->line_nr = args->line_nr;
al->fileloc = args->fileloc ? strdup(args->fileloc) : NULL;
al->data_nr = nr;
}
static void annotation_line__exit(struct annotation_line *al)
{
zfree_srcline(&al->path);
zfree(&al->fileloc);
zfree(&al->line);
zfree(&... | null | perf disasm: Fix potential use-after-free on fileloc
The fileloc is a copy of a pointer to a string but in places like
symbol_disassemble__llvm this string appears to be freed setting up
potential use-after-frees:
llvm.c:
```
dl = disasm_line__new(args);
if (dl == NULL)
goto err;
annotation_line__add(&dl->a... | true | [] | tools/perf/util/disasm.c | torvalds/linux | LIN_016780 | train |
juliet | C | CWE-327 | LOW | null | null | {
if(globalFalse)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
{
FILE *pFile;
HCRYPTPROV hCryptProv;
HCRYPTKEY hKey;
HCRYPTHASH hHash;
char password... | This code contains a software defect (CWE-327). Review carefully for memory safety issues. | false | [] | good1 | NIST/juliet | JUL_005871 | train |
juliet | C | CWE-127 | MEDIUM | {
char * data;
data = NULL;
if(globalReturnsTrue())
{
{
char * dataBuffer = (char *)malloc(100*sizeof(char));
if (dataBuffer == NULL) {exit(-1);}
memset(dataBuffer, 'A', 100-1);
dataBuffer[100-1] = '\0';
/* FLAW: Set data pointer to bef... | null | null | Buffer under-read. The code reads before the start of a buffer, potentially exposing unintended memory. | true | [
33
] | CWE127_Buffer_Underread__malloc_char_ncpy_11_bad | NIST/juliet | JUL_001206 | train |
juliet | C | CWE-272 | LOW | null | null | {
if(STATIC_CONST_FALSE)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
{
STARTUPINFOW si;
PROCESS_INFORMATION pi;
/* FIX: The commandLine parameter to CreateProcess() contai... | This code contains a software defect (CWE-272). Review carefully for memory safety issues. | false | [] | good1 | NIST/juliet | JUL_004647 | train |
juliet | C | CWE-325 | LOW | null | null | {
switch(5)
{
case 6:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
default:
{
BYTE payload[100];
DWORD payloadLen = strlen(PAYLOAD);
HCRYPTPROV hCryptProv = (HCRYPTPROV)NULL;
HCRYP... | This code contains a software defect (CWE-325). Review carefully for memory safety issues. | false | [] | good1 | NIST/juliet | JUL_005679 | train |
juliet | C | CWE-534 | LOW | {
if(globalReturnsTrue())
{
{
wchar_t password[100] = L"";
size_t passwordLen = 0;
HANDLE pHandle;
wchar_t * username = L"User";
wchar_t * domain = L"Domain";
FILE * pFile = fopen("debug.txt", "a+");
if (fgetws(password,... | null | null | This code contains a defect classified under CWE534 (Info Exposure Debug Log). The _bad variant demonstrates the vulnerability; good variants show the correct implementation. | true | [
63
] | CWE534_Info_Exposure_Debug_Log__w32_wchar_t_11_bad | NIST/juliet | JUL_011438 | train |
juliet | C | CWE-457 | LOW | null | null | {
wchar_t * data;
if(GLOBAL_CONST_TRUE)
{
/* POTENTIAL FLAW: Don't initialize data */
; /* empty statement needed for some flow variants */
}
if(GLOBAL_CONST_FALSE)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed strin... | Use of uninitialized variable. A variable is read before being assigned a value. | false | [] | goodB2G1 | NIST/juliet | JUL_008957 | train |
juliet | C | CWE-126 | LOW | null | null | {
goodG2B1();
goodG2B2();
} | This code contains a software defect (CWE-126). Review carefully for memory safety issues. | false | [] | CWE126_Buffer_Overread__malloc_char_memcpy_08_good | NIST/juliet | JUL_001122 | train |
juliet | C | CWE-284 | LOW | null | null | {
if(GLOBAL_CONST_FIVE==5)
{
{
wchar_t * keyName = L"TEST\\TestKey";
HKEY hKey;
/* FIX: Call RegCreateKeyExW() without KEY_ALL_ACCESS as the 6th parameter to limit access */
if (RegCreateKeyExW(
HKEY_CURRENT_USER,
... | This code contains a software defect (CWE-284). Review carefully for memory safety issues. | false | [] | good2 | NIST/juliet | JUL_005017 | train |
juliet | C | CWE-665 | LOW | {
wchar_t * data;
wchar_t dataBuffer[100];
data = dataBuffer;
if(staticFive==5)
{
/* FLAW: Do not initialize data */
; /* empty statement needed for some flow variants */
}
{
wchar_t source[100];
wmemset(source, L'C', 100-1); /* fill with L'C's */
sour... | null | null | This code contains a defect classified under CWE665 (Improper Initialization). The _bad variant demonstrates the vulnerability; good variants show the correct implementation. | true | [
35
] | CWE665_Improper_Initialization__wchar_t_cat_07_bad | NIST/juliet | JUL_013368 | train |
linux_kernel | C | CWE-476 | MEDIUM | // ...
switch (ch) {
case TLV493D_AXIS_X:
val = FIELD_GET(TLV493D_BX_MAG_X_AXIS_MSB, b[TLV493D_RD_REG_BX]) << 4 |
FIELD_GET(TLV493D_BX2_MAG_X_AXIS_LSB, b[TLV493D_RD_REG_BX2]) >> 4;
break;
case TLV493D_AXIS_Y:
val = FIELD_GET(TLV493D_BY_MAG_Y_AXIS_MSB, b[TLV493D_RD_REG_BY]) << 4 | | // ...
switch (ch) {
case TLV493D_AXIS_X:
val = FIELD_GET(TLV493D_BX_MAG_X_AXIS_MSB, b[TLV493D_RD_REG_BX]) << 4 |
FIELD_GET(TLV493D_BX2_MAG_X_AXIS_LSB, b[TLV493D_RD_REG_BX2]);
break;
case TLV493D_AXIS_Y:
val = FIELD_GET(TLV493D_BY_MAG_Y_AXIS_MSB, b[TLV493D_RD_REG_BY]) << 4 | | null | Merge tag 'char-misc-7.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char / misc / IIO driver fixes from Greg KH:
"Here are some char/misc/iio/binder fixes for 7.0-rc4. Nothing major in
here, just the usual:
- lots of iio driver fixes for reported issues
- rust binder fixes f... | true | [] | drivers/iio/magnetometer/tlv493d.c | torvalds/linux | LIN_016681 | train |
juliet | C | CWE-252 | LOW | null | null | {
if(globalFive==5)
{
/* FIX: check the return value */
if (fwrite((char *)"string", sizeof(char), strlen("string"), stdout) != strlen("string"))
{
printLine("fwrite failed!");
}
}
} | This code contains a software defect (CWE-252). Review carefully for memory safety issues. | false | [] | good2 | NIST/juliet | JUL_003801 | train |
juliet | C | CWE-191 | LOW | null | null | {
short data;
data = 0;
if(staticFalse)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Use a small, non-zero value that will not cause an underflow in the sinks */
data = -2;
}
i... | Integer underflow. An arithmetic operation produces a result below the minimum value. | false | [] | goodG2B1 | NIST/juliet | JUL_002285 | train |
juliet | C | CWE-478 | LOW | null | null | {
good1();
good2();
} | This code contains a software defect (CWE-478). Review carefully for memory safety issues. | false | [] | CWE478_Missing_Default_Case_in_Switch__basic_04_good | NIST/juliet | JUL_010237 | train |
juliet | C | CWE-426 | LOW | null | null | {
goodG2B();
} | This code contains a software defect (CWE-426). Review carefully for memory safety issues. | false | [] | CWE426_Untrusted_Search_Path__char_popen_34_good | NIST/juliet | JUL_008705 | train |
juliet | C | CWE-195 | LOW | null | null | {
{
char source[100];
char dest[100] = "";
memset(source, 'A', 100-1);
source[100-1] = '\0';
if (data < 100)
{
/* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative,
* the sign conversion could result in a very l... | This code contains a software defect (CWE-195). Review carefully for memory safety issues. | false | [] | goodG2BSink | NIST/juliet | JUL_002812 | train |
juliet | C | CWE-480 | LOW | null | null | {
if(staticReturnsFalse())
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: add () to function call */
if(helperGood() == NULL) /* this will sometimes be true (depending on the rand() in helperGoo... | This code contains a software defect (CWE-480). Review carefully for memory safety issues. | false | [] | good1 | NIST/juliet | JUL_010346 | train |
juliet | C | CWE-134 | LOW | null | null | {
{
va_list args;
va_start(args, data);
/* POTENTIAL FLAW: Do not specify the format allowing a possible format string vulnerability */
vwprintf(data, args);
va_end(args);
}
} | Uncontrolled format string. User input is used directly as a format string. | false | [] | goodG2BVaSink | NIST/juliet | JUL_001569 | train |
juliet | C | CWE-391 | LOW | null | null | {
if(globalFive==5)
{
{
size_t bytesTranslated = 0;
char charString[100];
charString[0] = '\0';
errno = 0; /* set errno to zero before calling wcstombs(), which can change its value */
bytesTranslated = wcstombs((char *)&charString, L"\xffff", ... | This code contains a software defect (CWE-391). Review carefully for memory safety issues. | false | [] | good2 | NIST/juliet | JUL_007158 | train |
juliet | C | CWE-401 | LOW | null | null | {
char * data;
data = NULL;
if(staticTrue)
{
/* FIX: Use memory allocated on the stack with ALLOCA */
data = (char *)ALLOCA(100*sizeof(char));
/* Initialize then use data */
strcpy(data, "a string");
printLine(data);
}
if(staticTrue)
{
/* POTEN... | Memory leak. Dynamically allocated memory is never freed. | false | [] | goodG2B2 | NIST/juliet | JUL_007858 | train |
juliet | C | CWE-761 | LOW | null | null | {
char * data;
data = (char *)malloc(100*sizeof(char));
if (data == NULL) {exit(-1);}
data[0] = '\0';
{
/* Append input from an environment variable to data */
size_t dataLen = strlen(data);
char * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environ... | This code contains a software defect (CWE-761). Review carefully for memory safety issues. | false | [] | goodB2G | NIST/juliet | JUL_015031 | train |
juliet | C | CWE-90 | LOW | null | null | {
wchar_t * data;
wchar_t dataBuffer[256] = L"";
data = dataBuffer;
/* FIX: Use a fixed file name */
wcscat(data, L"Doe, XXXXX");
{
wchar_t * dataCopy = data;
wchar_t * data = dataCopy;
{
LDAP* pLdapConnection = NULL;
ULONG connectSuccess = 0L;
... | This code contains a software defect (CWE-90). Review carefully for memory safety issues. | false | [] | goodG2B | NIST/juliet | JUL_016407 | train |
juliet | C | CWE-590 | LOW | {
twoIntsStruct * data;
data = NULL; /* Initialize data */
switch(6)
{
case 6:
{
/* FLAW: data is allocated on the stack and deallocated in the BadSink */
twoIntsStruct * dataBuffer = (twoIntsStruct *)ALLOCA(100*sizeof(twoIntsStruct));
{
size_t i;
... | null | null | This code contains a defect classified under CWE590 (Free Memory Not on Heap). The _bad variant demonstrates the vulnerability; good variants show the correct implementation. | true | [
30
] | CWE590_Free_Memory_Not_on_Heap__free_struct_alloca_15_bad | NIST/juliet | JUL_012294 | train |
juliet | C | CWE-690 | LOW | null | null | {
goodB2G1();
goodB2G2();
} | This code contains a software defect (CWE-690). Review carefully for memory safety issues. | false | [] | CWE690_NULL_Deref_From_Return__w32_wfopen_08_good | NIST/juliet | JUL_014651 | train |
juliet | C | CWE-758 | LOW | null | null | {
if(STATIC_CONST_TRUE)
{
{
double * data;
double * * pointer = (double * *)malloc(sizeof(double *));
if (pointer == NULL) {exit(-1);}
/* initialize both the pointer and the data pointed to */
data = (double *)malloc(sizeof(double));
... | This code contains a software defect (CWE-758). Review carefully for memory safety issues. | false | [] | good2 | NIST/juliet | JUL_014737 | train |
juliet | C | CWE-843 | LOW | null | null | {
void * data;
/* Initialize data */
data = NULL;
if(globalTrue)
{
{
/* FIX: Point data to an int */
int intBuffer = 8;
data = &intBuffer;
}
}
/* POTENTIAL FLAW: Attempt to access data as an int */
printIntLine(*((int*)data));
} | This code contains a software defect (CWE-843). Review carefully for memory safety issues. | false | [] | goodG2B2 | NIST/juliet | JUL_016125 | train |
juliet | C | CWE-194 | LOW | {
short data;
/* Initialize data */
data = 0;
if(STATIC_CONST_FIVE==5)
{
/* FLAW: Use a negative number */
data = -1;
}
{
char source[100];
char dest[100] = "";
memset(source, 'A', 100-1);
source[100-1] = '\0';
if (data < 100)
{... | null | null | This code contains a defect classified under CWE194 (Unexpected Sign Extension). The _bad variant demonstrates the vulnerability; good variants show the correct implementation. | true | [
31
] | CWE194_Unexpected_Sign_Extension__negative_memcpy_06_bad | NIST/juliet | JUL_002547 | train |
juliet | C | CWE-196 | LOW | null | null | {
while(1)
{
{
unsigned intUnsigned;
int intSigned;
intUnsigned = rand();
if (rand() % 2 == 0)
{
intUnsigned = UINT_MAX - intUnsigned;
}
/* FIX: don't allow very large values of intUnsigned */
... | This code contains a software defect (CWE-196). Review carefully for memory safety issues. | false | [] | good1 | NIST/juliet | JUL_002889 | train |
juliet | C | CWE-773 | LOW | null | null | {
goodB2G1();
goodB2G2();
} | This code contains a software defect (CWE-773). Review carefully for memory safety issues. | false | [] | CWE773_Missing_Reference_to_Active_File_Descriptor_or_Handle__w32CreateFile_03_good | NIST/juliet | JUL_015228 | train |
juliet | C | CWE-426 | LOW | null | null | {
goodG2B();
} | This code contains a software defect (CWE-426). Review carefully for memory safety issues. | false | [] | CWE426_Untrusted_Search_Path__wchar_t_system_52_good | NIST/juliet | JUL_008671 | train |
juliet | C | CWE-475 | LOW | null | null | {
good1();
good2();
} | This code contains a software defect (CWE-475). Review carefully for memory safety issues. | false | [] | CWE475_Undefined_Behavior_for_Input_to_API__char_03_good | NIST/juliet | JUL_009894 | train |
juliet | C | CWE-259 | LOW | null | null | {
char * password;
char passwordBuffer[100] = "";
password = passwordBuffer;
if(globalFalse)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
{
size_t passwordLen = 0;
/* FIX: ... | This code contains a software defect (CWE-259). Review carefully for memory safety issues. | false | [] | goodG2B1 | NIST/juliet | JUL_004565 | train |
juliet | C | CWE-843 | LOW | null | null | {
void * data;
/* Initialize data */
data = NULL;
{
/* FIX: Point data to an int */
int intBuffer = 8;
data = &intBuffer;
}
CWE843_Type_Confusion__char_64b_goodG2BSink(&data);
} | This code contains a software defect (CWE-843). Review carefully for memory safety issues. | false | [] | goodG2B | NIST/juliet | JUL_016241 | train |
juliet | C | CWE-675 | LOW | null | null | {
goodG2B();
goodB2G();
} | This code contains a software defect (CWE-675). Review carefully for memory safety issues. | false | [] | CWE675_Duplicate_Operations_on_Resource__w32CreateFile_66_good | NIST/juliet | JUL_013755 | train |
juliet | C | CWE-191 | LOW | null | null | {
int64_t data;
data = 0LL;
if(globalReturnsTrueOrFalse())
{
/* POTENTIAL FLAW: Use a value input from the console */
fscanf (stdin, "%" SCNd64, &data);
}
else
{
/* POTENTIAL FLAW: Use a value input from the console */
fscanf (stdin, "%" SCNd64, &data);
}
... | Integer underflow. An arithmetic operation produces a result below the minimum value. | false | [] | goodB2G | NIST/juliet | JUL_002448 | train |
juliet | C | CWE-319 | LOW | null | null | {
char * password;
char passwordBuffer[100] = "";
password = passwordBuffer;
/* FIX: Use a hardcoded password (it was not sent over the network)
* INCIDENTAL FLAW: CWE-259 Hard Coded Password */
strcpy(password, "Password1234!");
CWE319_Cleartext_Tx_Sensitive_Info__w32_char_connect_socket_68... | This code contains a software defect (CWE-319). Review carefully for memory safety issues. | false | [] | goodG2B | NIST/juliet | JUL_005137 | train |
juliet | C | CWE-226 | LOW | null | null | {
if(STATIC_CONST_FALSE)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
{
wchar_t password[100] = L"";
size_t passwordLen = 0;
HANDLE hUser;
wchar_t * username = ... | This code contains a software defect (CWE-226). Review carefully for memory safety issues. | false | [] | good1 | NIST/juliet | JUL_003436 | train |
juliet | C | CWE-681 | LOW | {
if(staticReturnsTrue())
{
{
char inputBuffer[CHAR_ARRAY_SIZE];
double doubleNumber = 0;
/* * Enter: -2.0, result should be 0 (for bad case)
*
* Square root of a negative number is NaN. NaN when casted to int is 0.
*/
... | null | null | This code contains a defect classified under CWE681 (Incorrect Conversion Between Numeric Types). The _bad variant demonstrates the vulnerability; good variants show the correct implementation. | true | [
55
] | CWE681_Incorrect_Conversion_Between_Numeric_Types__doubleNaN2int_08_bad | NIST/juliet | JUL_014295 | train |
juliet | C | CWE-121 | LOW | null | null | {
wchar_t * data;
wchar_t * dataBadBuffer = (wchar_t *)ALLOCA(50*sizeof(wchar_t));
wchar_t * dataGoodBuffer = (wchar_t *)ALLOCA(100*sizeof(wchar_t));
/* FIX: Set a pointer to a "large" buffer, thus avoiding buffer overflows in the sinks. */
data = dataGoodBuffer;
data[0] = L'\0'; /* null termina... | Stack-based buffer overflow. The code writes beyond the end of a stack-allocated buffer. | false | [] | goodG2B | NIST/juliet | JUL_000242 | train |
juliet | C | CWE-273 | LOW | {
if(GLOBAL_CONST_TRUE)
{
{
HANDLE hPipe = INVALID_HANDLE_VALUE;
hPipe = CreateNamedPipeA(
"\\\\.\\pipe\\test_pipe",
PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE,
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSA... | null | null | This code contains a defect classified under CWE273 (Improper Check for Dropped Privileges). The _bad variant demonstrates the vulnerability; good variants show the correct implementation. | true | [
50
] | CWE273_Improper_Check_for_Dropped_Privileges__w32_ImpersonateNamedPipeClient_09_bad | NIST/juliet | JUL_004887 | train |
juliet | C | CWE-835 | LOW | null | null | {
good1();
} | This code contains a software defect (CWE-835). Review carefully for memory safety issues. | false | [] | CWE835_Infinite_Loop__while_true_01_good | NIST/juliet | JUL_016095 | train |
juliet | C | CWE-479 | LOW | {
if(GLOBAL_CONST_FIVE==5)
{
signal(SIGINT, helperBad);
}
} | null | null | This code contains a defect classified under CWE479 (Signal Handler Use of Non Reentrant Function). The _bad variant demonstrates the vulnerability; good variants show the correct implementation. | true | [] | CWE479_Signal_Handler_Use_of_Non_Reentrant_Function__basic_13_bad | NIST/juliet | JUL_010289 | train |
juliet | C | CWE-457 | LOW | null | null | {
goodB2G1();
goodB2G2();
goodG2B1();
goodG2B2();
} | Use of uninitialized variable. A variable is read before being assigned a value. | false | [] | CWE457_Use_of_Uninitialized_Variable__wchar_t_pointer_04_good | NIST/juliet | JUL_008933 | train |
juliet | C | CWE-272 | LOW | null | null | {
good1();
good2();
} | This code contains a software defect (CWE-272). Review carefully for memory safety issues. | false | [] | CWE272_Least_Privilege_Violation__w32_char_RegCreateKey_07_good | NIST/juliet | JUL_004774 | train |
juliet | C | CWE-761 | LOW | null | null | {
char * data;
data = (char *)malloc(100*sizeof(char));
if (data == NULL) {exit(-1);}
data[0] = '\0';
{
/* Read input from the console */
size_t dataLen = strlen(data);
/* if there is room in data, read into it from the console */
if (100-dataLen > 1)
{
... | This code contains a software defect (CWE-761). Review carefully for memory safety issues. | false | [] | goodB2G1 | NIST/juliet | JUL_015024 | train |
juliet | C | CWE-665 | LOW | null | null | {
char * data;
char dataBuffer[100];
data = dataBuffer;
if(globalReturnsTrue())
{
/* FIX: Properly initialize data */
data[0] = '\0'; /* null terminate */
}
{
char source[100];
memset(source, 'C', 100-1); /* fill with 'C's */
source[100-1] = '\0'; /* n... | This code contains a software defect (CWE-665). Review carefully for memory safety issues. | false | [] | goodG2B2 | NIST/juliet | JUL_013416 | train |
juliet | C | CWE-666 | LOW | null | null | {
if(globalReturnsTrueOrFalse())
{
{
char data[100] = "";
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
char *replace;
SOCKET listenSocket = INVALID_SOCKET;
... | This code contains a software defect (CWE-666). Review carefully for memory safety issues. | false | [] | good1 | NIST/juliet | JUL_013563 | train |
juliet | C | CWE-122 | LOW | null | null | {
goodG2B();
} | Heap-based buffer overflow. The code writes past the end of a heap-allocated buffer. | false | [] | CWE122_Heap_Based_Buffer_Overflow__CWE131_memcpy_16_good | NIST/juliet | JUL_000444 | train |
juliet | C | CWE-226 | MEDIUM | {
if(staticFive==5)
{
{
char * password = (char *)ALLOCA(100*sizeof(char));
size_t passwordLen = 0;
HANDLE hUser;
char * username = "User";
char * domain = "Domain";
/* Initialize password */
password[0] = '\0';
... | null | null | Sensitive information not cleared before release. Memory with sensitive data is freed without zeroing, potentially exposing it. | true | [
68
] | CWE226_Sensitive_Information_Uncleared_Before_Release__w32_char_alloca_07_bad | NIST/juliet | JUL_003325 | train |
juliet | C | CWE-476 | LOW | null | null | {
long * data;
if(5==5)
{
/* POTENTIAL FLAW: Set data to NULL */
data = NULL;
}
if(5==5)
{
/* FIX: Check for NULL before attempting to print data */
if (data != NULL)
{
printLongLine(*data);
}
else
{
printLin... | NULL pointer dereference. The code dereferences a pointer that may be NULL, causing a crash. | false | [] | goodB2G2 | NIST/juliet | JUL_010091 | train |
juliet | C | CWE-617 | LOW | null | null | {
int data;
/* Initialize data */
data = -1;
if(staticTrue)
{
/* FIX: Use a value greater than the assert value */
data = ASSERT_VALUE+1;
}
/* POTENTIAL FLAW: this assertion could trigger if n <= ASSERT_VALUE */
assert(data > ASSERT_VALUE);
} | This code contains a software defect (CWE-617). Review carefully for memory safety issues. | false | [] | goodG2B2 | NIST/juliet | JUL_013004 | train |
juliet | C | CWE-427 | LOW | null | null | {
goodG2B1();
goodG2B2();
} | This code contains a software defect (CWE-427). Review carefully for memory safety issues. | false | [] | CWE427_Uncontrolled_Search_Path_Element__char_console_09_good | NIST/juliet | JUL_008874 | train |
juliet | C | CWE-325 | LOW | null | null | {
int k;
for(k = 0; k < 1; k++)
{
{
BYTE payload[100];
DWORD payloadLen = strlen(PAYLOAD);
HCRYPTPROV hCryptProv = (HCRYPTPROV)NULL;
HCRYPTHASH hHash = (HCRYPTHASH)NULL;
HCRYPTKEY hKey = (HCRYPTKEY)NULL;
char hashData[100] = HAS... | This code contains a software defect (CWE-325). Review carefully for memory safety issues. | false | [] | good1 | NIST/juliet | JUL_005551 | train |
juliet | C | CWE-476 | MEDIUM | {
long * data;
/* POTENTIAL FLAW: Set data to NULL */
data = NULL;
CWE476_NULL_Pointer_Dereference__long_54b_badSink(data);
} | null | null | NULL pointer dereference. A pointer that may be NULL is dereferenced, causing a crash. | true | [] | CWE476_NULL_Pointer_Dereference__long_54_bad | NIST/juliet | JUL_010133 | train |
juliet | C | CWE-191 | MEDIUM | {
int64_t data;
data = 0LL;
if(globalReturnsTrueOrFalse())
{
/* POTENTIAL FLAW: Use a value input from the console */
fscanf (stdin, "%" SCNd64, &data);
}
else
{
/* FIX: Use a small, non-zero value that will not cause an underflow in the sinks */
data = -2;
... | null | null | Integer underflow. An arithmetic operation produces a result below the minimum value for the data type. | true | [] | CWE191_Integer_Underflow__int64_t_fscanf_predec_12_bad | NIST/juliet | JUL_002447 | train |
juliet | C | CWE-369 | MEDIUM | {
int data;
/* Initialize data */
data = -1;
/* POTENTIAL FLAW: Set data to a random value */
data = RAND32();
/* POTENTIAL FLAW: Possibly divide by zero */
printIntLine(100 % data);
} | null | null | Divide by zero. A division where the divisor can be zero causes a runtime crash. | true | [] | CWE369_Divide_by_Zero__int_rand_modulo_01_bad | NIST/juliet | JUL_006651 | train |
juliet | C | CWE-114 | LOW | {
char * data;
char dataBuffer[100] = "";
data = dataBuffer;
{
/* Read input from the console */
size_t dataLen = strlen(data);
/* if there is room in data, read into it from the console */
if (100-dataLen > 1)
{
/* POTENTIAL FLAW: Read data from the c... | null | null | This code contains a defect classified under CWE114 (Process Control). The _bad variant demonstrates the vulnerability; good variants show the correct implementation. | true | [] | CWE114_Process_Control__w32_char_console_64_bad | NIST/juliet | JUL_000142 | train |
juliet | C | CWE-667 | LOW | null | null | {
good1();
} | This code contains a software defect (CWE-667). Review carefully for memory safety issues. | false | [] | CWE667_Improper_Locking__basic_12_good | NIST/juliet | JUL_013674 | train |
juliet | C | CWE-457 | LOW | null | null | {
wchar_t * data;
if(globalTrue)
{
/* POTENTIAL FLAW: Don't initialize data */
; /* empty statement needed for some flow variants */
}
if(globalTrue)
{
/* FIX: Ensure data is initialized before use */
data = L"string";
printWLine(data);
}
} | Use of uninitialized variable. A variable is read before being assigned a value. | false | [] | goodB2G2 | NIST/juliet | JUL_008940 | train |
juliet | C | CWE-366 | LOW | null | null | {
if(staticReturnsFalse())
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
{
stdThread threadA = NULL;
stdThread threadB = NULL;
if (!stdThreadLockCreate(&gGoodLock))
... | This code contains a software defect (CWE-366). Review carefully for memory safety issues. | false | [] | good1 | NIST/juliet | JUL_006279 | train |
juliet | C | CWE-253 | LOW | {
while(1)
{
/* FLAW: puts() might fail, in which case the return value will be EOF (-1), but
* we are checking to see if the return value is 0 */
if (PUTS("string") == 0)
{
printLine("puts failed!");
}
break;
}
} | null | null | This code contains a defect classified under CWE253 (Incorrect Check of Function Return Value). The _bad variant demonstrates the vulnerability; good variants show the correct implementation. | true | [
33
] | CWE253_Incorrect_Check_of_Function_Return_Value__char_puts_16_bad | NIST/juliet | JUL_004022 | train |
juliet | C | CWE-464 | LOW | {
char data;
data = ' ';
if(globalFive==5)
{
{
char charArraySource[2];
charArraySource[0] = (char)getc(stdin);
charArraySource[1] = '\0';
/* FLAW: If the character entered on the command line is not an int,
* a null value will be retu... | null | null | This code contains a defect classified under CWE464 (Addition of Data Structure Sentinel). The _bad variant demonstrates the vulnerability; good variants show the correct implementation. | true | [
30
] | CWE464_Addition_of_Data_Structure_Sentinel__basic_14_bad | NIST/juliet | JUL_009327 | train |
juliet | C | CWE-459 | LOW | null | null | {
if(staticFalse)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
{
wchar_t * filename;
wchar_t tmpl[] = L"goodXXXXXX";
FILE *pFile;
/* Establish that this is a te... | This code contains a software defect (CWE-459). Review carefully for memory safety issues. | false | [] | good1 | NIST/juliet | JUL_009176 | train |
juliet | C | CWE-377 | LOW | null | null | {
good1();
good2();
} | This code contains a software defect (CWE-377). Review carefully for memory safety issues. | false | [] | CWE377_Insecure_Temporary_File__char_mktemp_13_good | NIST/juliet | JUL_006904 | train |
juliet | C | CWE-510 | LOW | null | null | {
good1();
good2();
} | This code contains a software defect (CWE-510). Review carefully for memory safety issues. | false | [] | CWE510_Trapdoor__hostname_based_logic_02_good | NIST/juliet | JUL_010975 | train |
juliet | C | CWE-570 | LOW | null | null | {
/* FIX: Possibly evaluate to true */
if (globalReturnsTrueOrFalse() == staticFalse)
{
printLine("Sometimes prints");
}
} | This code contains a software defect (CWE-570). Review carefully for memory safety issues. | false | [] | good1 | NIST/juliet | JUL_012001 | train |
juliet | C | CWE-510 | LOW | null | null | {
if(GLOBAL_CONST_FIVE==5)
{
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
struct sockaddr_in service;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
do
{
#ifdef _WIN32
... | This code contains a software defect (CWE-510). Review carefully for memory safety issues. | false | [] | good2 | NIST/juliet | JUL_011028 | train |
juliet | C | CWE-591 | LOW | null | null | {
goodG2B();
} | This code contains a software defect (CWE-591). Review carefully for memory safety issues. | false | [] | CWE591_Sensitive_Data_Storage_in_Improperly_Locked_Memory__w32_wchar_t_53_good | NIST/juliet | JUL_012542 | train |
juliet | C | CWE-426 | LOW | {
char * data;
char dataBuffer[100] = "";
data = dataBuffer;
while(1)
{
/* FLAW: the full path is not specified */
strcpy(data, BAD_OS_COMMAND);
break;
}
{
FILE *pipe;
/* POTENTIAL FLAW: Executing the popen() function without specifying the full path t... | null | null | This code contains a defect classified under CWE426 (Untrusted Search Path). The _bad variant demonstrates the vulnerability; good variants show the correct implementation. | true | [
51
] | CWE426_Untrusted_Search_Path__char_popen_16_bad | NIST/juliet | JUL_008569 | train |
juliet | C | CWE-401 | LOW | null | null | {
char * data;
data = NULL;
if(staticReturnsTrue())
{
/* FIX: Use memory allocated on the stack with ALLOCA */
data = (char *)ALLOCA(100*sizeof(char));
/* Initialize then use data */
strcpy(data, "a string");
printLine(data);
}
if(staticReturnsTrue())
... | Memory leak. Dynamically allocated memory is never freed. | false | [] | goodG2B2 | NIST/juliet | JUL_007911 | train |
juliet | C | CWE-464 | LOW | null | null | {
goodG2B1();
goodG2B2();
} | This code contains a software defect (CWE-464). Review carefully for memory safety issues. | false | [] | CWE464_Addition_of_Data_Structure_Sentinel__basic_11_good | NIST/juliet | JUL_009348 | train |
juliet | C | CWE-675 | LOW | null | null | {
HANDLE data;
data = INVALID_HANDLE_VALUE; /* Initialize data */
if(GLOBAL_CONST_FIVE==5)
{
data = CreateFile("BadSource_w32CreateFile.txt",
(GENERIC_WRITE|GENERIC_READ),
0,
NULL,
OPEN_ALWAYS... | This code contains a software defect (CWE-675). Review carefully for memory safety issues. | false | [] | goodB2G1 | NIST/juliet | JUL_013821 | train |
juliet | C | CWE-124 | LOW | null | null | {
goodB2G1();
goodB2G2();
goodG2B1();
goodG2B2();
} | This code contains a software defect (CWE-124). Review carefully for memory safety issues. | false | [] | CWE124_Buffer_Underwrite__CWE839_rand_05_good | NIST/juliet | JUL_000928 | train |
juliet | C | CWE-273 | LOW | null | null | {
good1();
good2();
} | This code contains a software defect (CWE-273). Review carefully for memory safety issues. | false | [] | CWE273_Improper_Check_for_Dropped_Privileges__w32_ImpersonateNamedPipeClient_14_good | NIST/juliet | JUL_004909 | train |
juliet | C | CWE-273 | LOW | null | null | {
if(staticFive!=5)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
{
HANDLE hPipe = INVALID_HANDLE_VALUE;
hPipe = CreateNamedPipeA(
"\\\\.\\pipe\\test_pipe",
... | This code contains a software defect (CWE-273). Review carefully for memory safety issues. | false | [] | good1 | NIST/juliet | JUL_004880 | train |
juliet | C | CWE-398 | LOW | null | null | {
good1();
} | This code contains a software defect (CWE-398). Review carefully for memory safety issues. | false | [] | CWE398_Poor_Code_Quality__empty_for_01_good | NIST/juliet | JUL_007352 | train |
juliet | C | CWE-121 | LOW | null | null | {
wchar_t * data;
wchar_t * dataArray[5];
wchar_t dataBadBuffer[50];
wchar_t dataGoodBuffer[100];
/* FIX: Set a pointer to a "large" buffer, thus avoiding buffer overflows in the sinks. */
data = dataGoodBuffer;
data[0] = L'\0'; /* null terminate */
dataArray[2] = data;
CWE121_Stack_... | Stack-based buffer overflow. The code writes beyond the end of a stack-allocated buffer. | false | [] | goodG2B | NIST/juliet | JUL_000288 | train |
juliet | C | CWE-400 | LOW | null | null | {
/* POTENTIAL FLAW: Sleep function using count as the parameter with no validation */
SLEEP(count);
printLine("Sleep time possibly too long");
} | This code contains a software defect (CWE-400). Review carefully for memory safety issues. | false | [] | goodG2BSink | NIST/juliet | JUL_007599 | train |
juliet | C | CWE-321 | LOW | {
char * cryptoKey;
char cryptoKeyBuffer[100] = "";
cryptoKey = cryptoKeyBuffer;
badStatic = 1; /* true */
cryptoKey = badSource(cryptoKey);
{
HCRYPTPROV hCryptProv;
HCRYPTKEY hKey;
HCRYPTHASH hHash;
char toBeEncrypted[] = "String to be encrypted";
DWORD e... | null | null | This code contains a defect classified under CWE321 (Hard Coded Cryptographic Key). The _bad variant demonstrates the vulnerability; good variants show the correct implementation. | true | [] | CWE321_Hard_Coded_Cryptographic_Key__w32_char_21_bad | NIST/juliet | JUL_005398 | train |
juliet | C | CWE-665 | LOW | null | null | {
goodG2B1();
goodG2B2();
} | This code contains a software defect (CWE-665). Review carefully for memory safety issues. | false | [] | CWE665_Improper_Initialization__wchar_t_ncat_10_good | NIST/juliet | JUL_013403 | train |
juliet | C | CWE-843 | LOW | {
void * data;
CWE843_Type_Confusion__short_67_structType myStruct;
/* Initialize data */
data = NULL;
{
/* FLAW: Point data to a short */
short shortBuffer = 8;
data = &shortBuffer;
}
myStruct.structFirst = data;
CWE843_Type_Confusion__short_67b_badSink(myStruct)... | null | null | This code contains a defect classified under CWE843 (Type Confusion). The _bad variant demonstrates the vulnerability; good variants show the correct implementation. | true | [
35
] | CWE843_Type_Confusion__short_67_bad | NIST/juliet | JUL_016194 | train |
juliet | C | CWE-427 | LOW | {
char * data;
char dataBuffer[250] = "PATH=";
data = dataBuffer;
if(5==5)
{
{
/* Read input from a file */
size_t dataLen = strlen(data);
FILE * pFile;
/* if there is room in data, attempt to read the input from a file */
if (250-d... | null | null | This code contains a defect classified under CWE427 (Uncontrolled Search Path Element). The _bad variant demonstrates the vulnerability; good variants show the correct implementation. | true | [] | CWE427_Uncontrolled_Search_Path_Element__char_file_03_bad | NIST/juliet | JUL_008915 | train |
juliet | C | CWE-404 | LOW | {
int data;
int *dataPtr1 = &data;
int *dataPtr2 = &data;
/* Initialize data */
data = -1;
{
int data = *dataPtr1;
/* POTENTIAL FLAW: Open a file - need to make sure it is closed properly in the sink */
data = OPEN("BadSource_open.txt", O_RDWR|O_CREAT, S_IREAD|S_IWRITE);
... | null | null | This code contains a defect classified under CWE404 (Improper Resource Shutdown). The _bad variant demonstrates the vulnerability; good variants show the correct implementation. | true | [
48
] | CWE404_Improper_Resource_Shutdown__open_w32CloseHandle_32_bad | NIST/juliet | JUL_008057 | train |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 12