Back to index

glibc  2.9
Functions
strcpy.c File Reference
#include <stddef.h>
#include <string.h>
#include <memcopy.h>
#include <bp-checks.h>

Go to the source code of this file.

Functions

char * strcpy (char *dest, const char *src)

Function Documentation

char* strcpy ( char *  dest,
const char *  src 
)

Definition at line 28 of file strcpy.c.

{
  reg_char c;
  char *__unbounded s = (char *__unbounded) CHECK_BOUNDS_LOW (src);
  const ptrdiff_t off = CHECK_BOUNDS_LOW (dest) - s - 1;
  size_t n;

  do
    {
      c = *s++;
      s[off] = c;
    }
  while (c != '\0');

  n = s - src;
  (void) CHECK_BOUNDS_HIGH (src + n);
  (void) CHECK_BOUNDS_HIGH (dest + n);

  return dest;
}