From the course: Secure Coding in C
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Challenge: Enter the combination - C Tutorial
From the course: Secure Coding in C
Challenge: Enter the combination
(upbeat music) - [Narrator] For this challenge you are to work with a code presented in this exercise file. The main function prompts for three digits, the combination for a safe or something else secure. At line 16 you see the get number function called. This function is skeleton ed at line four. Your challenge is to write the get number function which provides the integer values comprising the combination. The get number function must perform the following tasks. It must allocate a pointer for an input buffer. It must obtain and verify string input. String input must be converted to an integer value, verified of course. Other requirements must also be made in a get number function to ensure that it's safe. And the main function could also use one additional statement to add some security. This challenge could take up to 20 minutes to complete.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.