#include <stdio.h>
#include <string.h>

/* not completely the same as ISO/IEC memcpy_s */
#define memcpy_s(d, dz, s, sz) memcpy((d), (s), ((dz)<=(sz)?(dz):(sz)))

char buf[] = "0123456789abcdef";

int get_buf(char *str)
{
#if defined(UNSAFE)
  memcpy(buf, str, strlen(str));
#else
  size_t sz = strlen(str);
  memcpy(buf, str, (sizeof(buf)-1 <= sz ? sizeof(buf)-1 : sz));
  /*memcpy_s(buf, sizeof(buf)-1, str, sz);*/
#endif
  return 0;
}

int main(int argc, char *argv[])
{
  if (argc == 1+1) {
    get_buf(argv[1]);
  }
  puts(buf);
  return 0;
}
