Kev Li

Kev Li

  • NA
  • 7
  • 0

Some help with a small piece of code

Aug 13 2008 5:32 AM
Hi everyone,

I am trying to understand a question set to me by my lecturer. The textbook given to us doesn't provide any information on it as well.

Below is an example of a code that the lecturer wants us to edit so that it is no longer vulnerable to buffer overflow attacks.

            int copy_buf(char *to, int pos, char *from, int len)

     {

          int i;

          for (i=0; i<len; i++) {

              to[pos] = from[i];

              pos++;

          }

     return pos;

     }

does anyone have any ideas how to do this? or able to solve this?
- Thanks

Answers (8)