CSE 466: Project 3
(File formats on Linux)

Due: Oct 31 2017 (in class, hardcopy).



 Projects to be done in groups of two.


File needed in this project are in this ZIP file



A program (compiles under any version of Linux) is in program1.c. It reads from keyboard and prints.

A] Run this program and type in numbers, or strings (include spaces) and observe its output. Vary the length of the string from 1 character to 15 characters.

B] Change the 1 in the 3rd parameter of read() to 4 and observe behavior.


Submit: Write a short explanation on observations and explanations (that is, what can you infer from this program behavior and why does it behave the way it does, which can be sometimes “strange”).


Experiment:  Replace read() with gets() and scanf(“%s”…) and see what changes. Do not submit this part.




You are provided with three files, f1, f2 and f3


Do the following:


  1. The file f1 contains a set of numbers in ASCII (decimal format).

Write a program to: Read the contents of f1 into an array of integers. Write these integers into a file f4 that contains the integers in binary format. Then read the contents of f4 into another array of integers and compare the two. (Compare manually or via program).

  1. The file f2 contains a set of numbers in binary format.
    Write a program to: Read the contents of f2 into an array of integers. Write the array out into a file f5, such that the file is readable by humans (decimal).
  2. The file f3 contains a set of numbers, just like f2. However you may find f3 to be different from f2. Use the program written in #2 to create a file f6 that contains a set of numbers, just like you did in #2. However you should notice that f5 is quite different from f6.


Submit: Provide one/two line printouts of the input and output routines you used for each program. Also state what you observed.




There is a program (psuedocode somewhat) in the file prog-bad.c. This program is not written to be compiled or run, but to be read. Sorry, missing comments.


Find what the vulnerabilities are, and what these vulnerabilities may cause and write a short explanation of what you found.