Question: QUESTION 11 Consider the following code example, assume that form_field_1 comes from unfiltered user input to a web form field. char format [64]; strncpy (format,

QUESTION 11

Consider the following code example, assume that form_field_1 comes from unfiltered user input to a web form field.

char format [64];

strncpy (format, Name: , 6);

strncat(format, form_field_1, 25);

strncat (format, , count: %d, 11);

sprintf (target, format, num);

What will happen if the user enters %s%s%s%s into form_field_1?

a.

The function would copy to target a number.

b.

The function would try to access the memory for a variable that isnt there

c.

The function would copy to target the value of num.

d.

The function would copy to target Name: %s%s%s%s, count: %d.

QUESTION 12

Considering the same code example in question 11.

What will happen if the user enters %n%n%n%n into form_field_1?

a.

The function would read from the buffer

b.

The function would copy to target a number.

c.

The function would copy to target Name: %n%n%n%n, count: %d.

d.

The function would write to the buffer

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!