Are there any memory issues in the following code? Please assume that variable inputsize has the correct size.

int add_num_array(int inputsize, int num) {
    int *newnum = malloc (inputsize * sizeof(int));  /* 1 */
    int i;   
    for (i=0; i
  1. No vulnerabilities are present

  2. Line 1 should only use malloc(inputsize);

  3. Line 2 should be for (i=0; i<=n, i++)

  4. Line 1 should use calloc() instead of malloc()


Correct Option: D

Find more quizzes: