Skip to content

Commit 5f7baac

Browse files
committed
Merge branch 'maint'
* maint: t/README: clarify test_must_fail description Check size of path buffer before writing into it Conflicts: t/README
2 parents c5212b8 + 971ecbd commit 5f7baac

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

setup.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ static int is_git_directory(const char *suspect)
170170
char path[PATH_MAX];
171171
size_t len = strlen(suspect);
172172

173+
if (PATH_MAX <= len + strlen("/objects"))
174+
die("Too long path: %.*s", 60, suspect);
173175
strcpy(path, suspect);
174176
if (getenv(DB_ENVIRONMENT)) {
175177
if (access(getenv(DB_ENVIRONMENT), X_OK))

t/README

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,10 @@ library for your script to use.
451451
- test_must_fail <git-command>
452452

453453
Run a git command and ensure it fails in a controlled way. Use
454-
this instead of "! <git-command>" to fail when git commands
455-
segfault.
454+
this instead of "! <git-command>". When git-command dies due to a
455+
segfault, test_must_fail diagnoses it as an error; "! <git-command>"
456+
treats it as just another expected failure, which would let such a
457+
bug go unnoticed.
456458

457459
- test_might_fail <git-command>
458460

0 commit comments

Comments
 (0)