


In a Terminal window, execute this command. Names longer than 10 characters will cause user-input data to overwrite parts of memory that were not intended to store data, making the program crash. That's because it takes the name from typed input and puts it in the name string, but the name string has a size limit-it only has enough room for 10 characters. The hello2 program is poorly written, and exposes your machine to being exploited by hackers. When you type in your name (no longer than 10 characters), you should be greeted by name, as shown below:Ĭrashing the hello2 Program With a Long Name-Buffer Overflow In a Terminal window, execute these commands: gcc hello2.c -o hello2 In a Terminal window, execute this command: nano hello2.c The next version, hello2, will add these features. This program works, but it would be nicer if it greeted you by name, and if it put a couple of newline characters after the greeting to make it cleaner-looking. You should see "Hello World!", as shown below. These commands compile the hello.c program, creating an executable machine language file named hello, In a Terminal window, execute these commands: gcc hello.c -o hello Type in the program shown below.Ĭompiling hello.c to Create the hello File In a Terminal window, execute this command: nano hello.c You could use other operating systems too, if they have a C compiler. Project 8: C Programming on Linux (15 points) What You Need for This Project Project 8: C Programming on Linux (15 points)
