blob: a7513494dc74701641e4486022af586a76001ce3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
#include <stdio.h>
void
safecpy(char *to, char *from, int tolen)
{
int fromlen;
memset(to, 0, tolen);
fromlen = from ? strlen(from) : 0;
if (fromlen > tolen)
fromlen = tolen;
memcpy(to, from, fromlen);
}
|