- die if malloc fails.
- use strlcpy. Obtained from: KAME MFC after: 1 week
This commit is contained in:
parent
be71e4ad8a
commit
1dd7cfc46f
@ -3261,9 +3261,15 @@ char *
|
||||
allocopy(p)
|
||||
char *p;
|
||||
{
|
||||
char *q = (char *)malloc(strlen(p) + 1);
|
||||
int len = strlen(p) + 1;
|
||||
char *q = (char *)malloc(len);
|
||||
|
||||
strcpy(q, p);
|
||||
if (!q) {
|
||||
fatal("malloc");
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
strlcpy(q, p, len);
|
||||
return q;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user