xref: /plan9/sys/src/cmd/unix/u9fs/safecpy.c (revision 50a9bdd425267f47e4e77489986ba84a0ae9d1f2)
1 #include <stdio.h>
2 
3 void
safecpy(char * to,char * from,int tolen)4 safecpy(char *to, char *from, int tolen)
5 {
6 	int fromlen;
7 	memset(to, 0, tolen);
8 	fromlen = from ? strlen(from) : 0;
9 	if (fromlen > tolen)
10 		fromlen = tolen;
11 	memcpy(to, from, fromlen);
12 }
13