Skip to content

Commit e4f12f1

Browse files
committed
Merge branch 'maint/v1.4' into opencor.
2 parents 96b946a + 7678e4e commit e4f12f1

28 files changed

Lines changed: 674 additions & 112 deletions

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
cmake_minimum_required(VERSION 3.5.1)
55

6-
project(libgit2 VERSION "1.4.0" LANGUAGES C)
6+
project(libgit2 VERSION "1.4.3" LANGUAGES C)
77

88
# Add find modules to the path
99
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")

docs/changelog.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
v1.4.3
2+
------
3+
4+
🔒 This is a security release to provide compatibility with git's changes to address [CVE 2022-24765](https://github.blog/2022-04-12-git-security-vulnerability-announced/).
5+
6+
**libgit2 is not directly affected** by this vulnerability, because libgit2 does not directly invoke any executable. But we are providing these changes as a security release for any users that use libgit2 for repository discovery and then _also_ use git on that repository. In this release, we will now validate that the user opening the repository is the same user that owns the on-disk repository. This is to match git's behavior.
7+
8+
In addition, we are providing several correctness fixes where invalid input can lead to a crash. These may prevent possible denial of service attacks. At this time there are not known exploits to these issues.
9+
10+
Full list of changes:
11+
12+
* Validate repository directory ownership (v1.4) by @ethomson in https://github.com/libgit2/libgit2/pull/6267
13+
* midx: Fix an undefined behavior (left-shift signed overflow) by @lhchavez in https://github.com/libgit2/libgit2/pull/6260
14+
* fetch: support OID refspec without dst by @ethomson in https://github.com/libgit2/libgit2/pull/6251
15+
* Fix crash when regenerating a patch with unquoted spaces in filename by @jorio in https://github.com/libgit2/libgit2/pull/6244
16+
17+
All users of the v1.4 release line are recommended to upgrade.
18+
19+
**Full Changelog**: https://github.com/libgit2/libgit2/compare/v1.4.2...v1.4.3
20+
121
v1.4.2
222
------
323

62 Bytes
Binary file not shown.

include/git2/common.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,9 @@ typedef enum {
214214
GIT_OPT_SET_ODB_PACKED_PRIORITY,
215215
GIT_OPT_SET_ODB_LOOSE_PRIORITY,
216216
GIT_OPT_GET_EXTENSIONS,
217-
GIT_OPT_SET_EXTENSIONS
217+
GIT_OPT_SET_EXTENSIONS,
218+
GIT_OPT_GET_OWNER_VALIDATION,
219+
GIT_OPT_SET_OWNER_VALIDATION
218220
} git_libgit2_opt_t;
219221

220222
/**
@@ -452,6 +454,14 @@ typedef enum {
452454
* > to support repositories with the `noop` extension but does want
453455
* > to support repositories with the `newext` extension.
454456
*
457+
* opts(GIT_OPT_GET_OWNER_VALIDATION, int *enabled)
458+
* > Gets the owner validation setting for repository
459+
* > directories.
460+
*
461+
* opts(GIT_OPT_SET_OWNER_VALIDATION, int enabled)
462+
* > Set that repository directories should be owned by the current
463+
* > user. The default is to validate ownership.
464+
*
455465
* @param option Option key
456466
* @param ... value to set the option
457467
* @return 0 on success, <0 on failure

include/git2/errors.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ typedef enum {
5757
GIT_RETRY = -32, /**< Internal only */
5858
GIT_EMISMATCH = -33, /**< Hashsum mismatch in object */
5959
GIT_EINDEXDIRTY = -34, /**< Unsaved changes in the index would be overwritten */
60-
GIT_EAPPLYFAIL = -35 /**< Patch application failed */
60+
GIT_EAPPLYFAIL = -35, /**< Patch application failed */
61+
GIT_EOWNER = -36 /**< The object is not owned by the current user */
6162
} git_error_code;
6263

6364
/**

include/git2/version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
#ifndef INCLUDE_git_version_h__
88
#define INCLUDE_git_version_h__
99

10-
#define LIBGIT2_VERSION "1.4.2"
10+
#define LIBGIT2_VERSION "1.4.3"
1111
#define LIBGIT2_VER_MAJOR 1
1212
#define LIBGIT2_VER_MINOR 4
13-
#define LIBGIT2_VER_REVISION 2
13+
#define LIBGIT2_VER_REVISION 3
1414
#define LIBGIT2_VER_PATCH 0
1515

1616
#define LIBGIT2_SOVERSION "1.4"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "libgit2",
3-
"version": "1.4.0",
3+
"version": "1.4.3",
44
"repo": "https://github.com/libgit2/libgit2",
55
"description": " A cross-platform, linkable library implementation of Git that you can use in your application.",
66
"install": "mkdir build && cd build && cmake .. && cmake --build ."

src/config.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,14 +1170,18 @@ int git_config_find_programdata(git_buf *path)
11701170

11711171
int git_config__find_programdata(git_str *path)
11721172
{
1173-
int ret;
1173+
bool is_safe;
11741174

1175-
ret = git_sysdir_find_programdata_file(path, GIT_CONFIG_FILENAME_PROGRAMDATA);
1175+
if (git_sysdir_find_programdata_file(path, GIT_CONFIG_FILENAME_PROGRAMDATA) < 0 ||
1176+
git_fs_path_owner_is_system_or_current_user(&is_safe, path->ptr) < 0)
1177+
return -1;
11761178

1177-
if (ret != GIT_OK)
1178-
return ret;
1179+
if (!is_safe) {
1180+
git_error_set(GIT_ERROR_CONFIG, "programdata path has invalid ownership");
1181+
return -1;
1182+
}
11791183

1180-
return git_fs_path_validate_system_file_ownership(path->ptr);
1184+
return 0;
11811185
}
11821186

11831187
int git_config__global_location(git_str *buf)

src/describe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ int git_describe_commit(
652652
{
653653
struct get_name_data data;
654654
struct commit_name *name;
655-
git_commit *commit;
655+
git_commit *commit = NULL;
656656
int error = -1;
657657
git_describe_options normalized;
658658

src/diff_print.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,11 @@ static int diff_print_oid_range(
316316
static int diff_delta_format_path(
317317
git_str *out, const char *prefix, const char *filename)
318318
{
319+
if (!filename) {
320+
/* don't prefix "/dev/null" */
321+
return git_str_puts(out, "/dev/null");
322+
}
323+
319324
if (git_str_joinpath(out, prefix, filename) < 0)
320325
return -1;
321326

0 commit comments

Comments
 (0)