tCheck if repo is NULL or at least length 3. - git-restrict - simple utility for git repo permission management HTML git clone https://git.parazyd.org/git-restrict DIR Log DIR Files DIR Refs DIR README DIR LICENSE --- DIR commit 4b058c56969092d43b32d96c9187204f1c93ab6d DIR parent 519b8e62121e2f23966f8133d0384710af8c21e7 HTML 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: M git-restrict.c | 4 ++++ 1 file changed, 4 insertions(+), 0 deletions(-) --- DIR diff --git a/git-restrict.c b/git-restrict.c t@@ -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;