git-restrict

simple utility for git repo permission management
git clone https://git.parazyd.org/git-restrict
Log | Files | Refs | README | LICENSE

commit 4b058c56969092d43b32d96c9187204f1c93ab6d
parent 519b8e62121e2f23966f8133d0384710af8c21e7
Author: parazyd <parazyd@dyne.org>
Date:   Wed, 31 Mar 2021 11:09:10 +0200

Check if repo is NULL or at least length 3.

The SSH_ORIGINAL_COMMAND should at least look like:

	git-upload-pack 'a'

(Note that the repository is quoted)

Diffstat:
Mgit-restrict.c | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/git-restrict.c b/git-restrict.c @@ -44,6 +44,10 @@ int main(int argc, char *argv[]) if (strcmp("git-upload-pack", cmd) && strcmp("git-receive-pack", cmd)) die("fatal: Unauthorized command."); + /* Repository name should at least be: 'a' */ + if (repo == NULL || (strlen(repo) < 3)) + die("fatal: Invalid repository name."); + /* Remove ' prefix and suffix */ repo++; repo[strlen(repo) - 1] = 0;