Consider the following code fragment and answer below 1. Read(fd, user entry, size of (user entry)); 2....

60.1K

Verified Solution

Question

Programming

Consider the following code fragment and answer below
1. Read(fd, user entry, size of (user entry));
2. Comp=memcmp(userEntry, correct password, stream( userEntry));
3. If (Comp!=0)
4. Return BAD_PASS

- identify any 3 problems with code 8 for each defectdescribe:

- A) what is this problem
- B) how it can be found (code, review, Staticanalysis.....)
- C) how it can be solved

Answer & Explanation Solved by verified expert
4.2 Ratings (568 Votes)
Ans The 3 defects are 1 read function call The 3rd argument should be the number of bytes to be read from the file into the buffer and not the buffer size This problem can be found by static analysis It can be    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students