mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-14 22:32:30 +01:00
Use strdup instead of malloc + strcpy
Submitted by: db Approved by: cperciva MFC after: 2 weeks
This commit is contained in:
parent
6c3c59886c
commit
91d073903e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=243896
@ -56,12 +56,10 @@ setpwdir(const char * dir)
|
||||
{
|
||||
if (dir == NULL)
|
||||
return -1;
|
||||
else {
|
||||
char * d = malloc(strlen(dir)+1);
|
||||
if (d == NULL)
|
||||
return -1;
|
||||
pwpath = strcpy(d, dir);
|
||||
}
|
||||
else
|
||||
pwpath = strdup(dir);
|
||||
if (pwpath == NULL)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user