...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <threads.h> int account_balance; mtx_t flag; /* Initialize flag */ voidint debit(unsigned int amount) { if (mtx_lock(&flag) == thrd_error) { return -1; /* Indicate error */ } account account_balance -= amount; /* Inside critical section */ if (mtx_unlock(&flag) == thrd_error) { return -1; /* Indicate error */ } return 0; } |
Risk Assessment
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
CON02-C | Medium | Probable | Medium | P8 | L2 |
...