Nick Kralevich f3913b5b68 FORTIFY_SOURCE: enhanced memcpy protections.
Two changes:

1) Detect memory read overruns.

For example:

int main() {
  char buf[10];
  memcpy(buf, "abcde", sizeof(buf));
  sprintf("%s\n", buf);
}

because "abcde" is only 6 bytes, copying 10 bytes from it is a bug.
This particular bug will be detected at compile time.  Other similar
bugs may be detected at runtime.

2) Detect overlapping buffers on memcpy()

It is a bug to call memcpy() on buffers which overlap. For
example, the following code is buggy:

  char buf3[0x800];
  char *first_half  = &buf3[0x400];
  char *second_half = &buf3[1];
  memset(buf3, 0, sizeof(buf3));
  memcpy(first_half, second_half, 0x400);
  printf("1: %s\n", buf3);

We now detect this at compile and run time.

Change-Id: I092bd89f11f18e08e8a9dda0ca903aaea8e06d91
2012-07-12 15:38:15 -07:00
..
2010-12-06 12:05:11 +01:00
2011-09-28 12:17:34 -07:00
2012-02-29 18:43:51 -08:00
2010-01-15 15:57:02 -08:00
2012-07-09 12:30:40 -07:00
2010-01-15 15:57:02 -08:00
2009-03-03 19:28:35 -08:00
2010-01-15 15:57:02 -08:00
2009-03-03 19:28:35 -08:00
2010-01-15 15:01:44 -08:00
2010-12-20 15:58:06 +01:00
2012-07-09 09:57:18 -07:00
2010-06-11 14:39:39 -07:00
2012-04-13 15:45:42 -07:00