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:
Junio C Hamano
2014-07-21 12:35:39 -07:00
10 changed files with 10 additions and 27 deletions

4
path.c
View File

@ -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;