Multiple choice technology security

While trying to print an eight character long name, which of the following will introduce a security vulnerability ?

printf ("%.8s",name); /* 1 */
printf (name);  /* 2 */ 
printf ("%s",name);  /* 3 */ 
printf ("%8c", name);  /* 4 */

  1. 1 and 2

  2. 2 and 3

  3. 3 and 4

  4. only 2

Reveal answer Fill a bubble to check yourself
B Correct answer