Merge branch 'maint'
* maint: use xmemdupz() to allocate copies of strings given by start and length use xcalloc() to allocate zero-initialized memory
This commit is contained in:
4
path.c
4
path.c
@ -249,9 +249,7 @@ int validate_headref(const char *path)
|
||||
static struct passwd *getpw_str(const char *username, size_t len)
|
||||
{
|
||||
struct passwd *pw;
|
||||
char *username_z = xmalloc(len + 1);
|
||||
memcpy(username_z, username, len);
|
||||
username_z[len] = '\0';
|
||||
char *username_z = xmemdupz(username, len);
|
||||
pw = getpwnam(username_z);
|
||||
free(username_z);
|
||||
return pw;
|
||||
|
Reference in New Issue
Block a user