1936
Relevant to the view "CISQ Quality Measures (2020)" (CWE-1305)
Nature Type ID Name Page
ChildOf 662 Improper Synchronization 1448
Relevant to the view "CISQ Data Protection Measures" (CWE-1340)
Nature Type ID Name Page
ChildOf 662 Improper Synchronization 1448
Relevant to the view "Software Development" (CWE-699)
Nature Type ID Name Page
MemberOf 557 Concurrency Issues 2329
Common Consequences
Scope Impact Likelihood
Integrity
Confidentiality
Other
Modify Application Data
Read Application Data
Alter Execution Logic
Demonstrative Examples
Example 1:
The following code intends to fork a process, then have both the parent and child processes print a
single line.
Example Language: C (Bad)
static void print (char * string) {
char * word;
int counter;
for (word = string; counter = *word++; ) {
putc(counter, stdout);
fflush(stdout);
/* Make timing window a little larger... */
sleep(1);
}
}
int main(void) {
pid_t pid;
pid = fork();
if (pid == -1) {
exit(-2);
}
else if (pid == 0) {
print("child\n");
}
else {
print("PARENT\n");
}
exit(0);
}
One might expect the code to print out something like:
PARENT
child
CWE Version 4.14
CWE-821: Incorrect Synchronization
CWE-821: Incorrect Synchronization