logo

Secure Systems Programming

   

Added on  2022-12-28

13 Pages1507 Words3 Views
Running Head: SECURE SYSTEMS PROGRAMMING
SECURE SYSTEMS PROGRAMMING
Name of the Student:
Name of the University:
Author Note:
Secure Systems Programming_1
2SECURE SYSTEMS PROGRAMMING
Table of Contents
Answer to question 1:......................................................................................................................3
Answer to question 2:......................................................................................................................4
Answer to question 3:......................................................................................................................5
Answer to question 4:......................................................................................................................6
Answer to question 5:......................................................................................................................8
References......................................................................................................................................11
Secure Systems Programming_2
3SECURE SYSTEMS PROGRAMMING
Answer to question 1:
Error 1: The character array source on line 2 has a length of 10 bytes but the function strcpy() in
line 5 copies 11 characters including the null character. To fix this error the length of the source
character array should be changed to 11.
Error 2: In line 6 the definition of malloc function is written wrong.
The correct way to define that line would be: char *dest = (char *)malloc(strlen(source));
Error 3: In the for loop the index value of i, present in line 7, starts at 1, but the first position in
a C array is indexed at 0. The solution to this problem is to start the for loop with 0.
Error 4: In line 7 the for loop has an ending condition as i<=11 and for this the loop will iterate
extra one time even if the programmer does not want it to be. The solution to this would be to
change the value of iteration to i<11 or i<=10.
Error 5: On line 10 it is an out of bound write. The solution to this would be just to remove that
line from the code.
Secure Systems Programming_3
4SECURE SYSTEMS PROGRAMMING
Answer to question 2:
Secure Systems Programming_4

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Secure Programming in C
|14
|2158
|367

Understanding Buffer Overflow: Stack and Heap Buffer Overflows, Exploiting Buffer Overflow, JOP and ROP
|11
|1080
|283

Secure Systems Programming: Coursework 2
|10
|2518
|90

Common Errors in C Programming and How to Fix Them
|6
|1243
|342

Solution Question 1: 1) 2) 3) 4).
|2
|340
|68

Common Programming Errors and Security Measures
|9
|2871
|70