X-Git-Url: https://git.octo.it/?p=git.git;a=blobdiff_plain;f=config.c;h=984c75f5dd06bd1d53eda206a2b57eea093dfd58;hp=2ae6153e5ee29ca88f52241d1ece79069d8c5875;hb=HEAD;hpb=6de08ae688b9f2426410add155079e04baff33bd diff --git a/config.c b/config.c index 2ae6153e..984c75f5 100644 --- a/config.c +++ b/config.c @@ -280,17 +280,17 @@ int git_default_config(const char *var, const char *value) } if (!strcmp(var, "user.name")) { - strncpy(git_default_name, value, sizeof(git_default_name)); + safe_strncpy(git_default_name, value, sizeof(git_default_name)); return 0; } if (!strcmp(var, "user.email")) { - strncpy(git_default_email, value, sizeof(git_default_email)); + safe_strncpy(git_default_email, value, sizeof(git_default_email)); return 0; } if (!strcmp(var, "i18n.commitencoding")) { - strncpy(git_commit_encoding, value, sizeof(git_commit_encoding)); + safe_strncpy(git_commit_encoding, value, sizeof(git_commit_encoding)); return 0; } @@ -536,7 +536,7 @@ int git_config_set_multivar(const char* key, const char* value, * contents of .git/config will be written into it. */ fd = open(lock_file, O_WRONLY | O_CREAT | O_EXCL, 0666); - if (fd < 0) { + if (fd < 0 || adjust_shared_perm(lock_file)) { fprintf(stderr, "could not lock config file\n"); free(store.key); ret = -1;