blob: b7daeea5ca768388ad1fabbb6a128790b3b5f105 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
#include <string.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);
}
|