Question: For Code Snippet F , Find 2 vulnerabilities: 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3

For Code Snippet F, Find 2 vulnerabilities:
1234567891011121314151617181920212223242526272829
struct mutex *o1; FILE *file; void release(){ lock_unlock(false); } void code_snippet_F(int count){ probe(); if(count >0){ release(); }}// can be called only from function code_snippet_F or release. void probe(){ lock_unlock(true); file = fopen("fileopen","mode"); // write some data to shared file. }// can be called only from function probe and release. void lock_unlock(bool c){ if(c){ lock(o1); // indefinitely blocking other threads from modifying shared object } else { unlock(o1); // unlocks }}
Your answer must be following the template:
The Code Snippet has 2 vulnerabilities.
The first vulnerability is associated with CWE Insert CWEand the vulnerable potentially feasible path isInsert Vulnerable Path.
The second vulnerability is associated with CWE Insert CWEand the vulnerable potentially feasible path is Insert Vulnerable Path.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!