diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2018-06-10 18:51:58 +0200 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2018-06-10 18:51:58 +0200 |
commit | f356ebbc13491a98c397920097494958efb042dd (patch) | |
tree | 84b3ae4a7926bca040c2201d103f634bd0d277d5 /src | |
parent | f11ee7c4354d33c173116aec3179c1b483e3a63e (diff) | |
download | blogc-f356ebbc13491a98c397920097494958efb042dd.tar.gz blogc-f356ebbc13491a98c397920097494958efb042dd.tar.bz2 blogc-f356ebbc13491a98c397920097494958efb042dd.zip |
git-receiver: fixed segfault on pre-receive hook
if a [repo:*] section was defined in blogc-git-receiver.ini, but was not
providing a symlink value, that would result in a segfault.
Diffstat (limited to 'src')
-rw-r--r-- | src/blogc-git-receiver/pre-receive.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/blogc-git-receiver/pre-receive.c b/src/blogc-git-receiver/pre-receive.c index 9611567..2081b4f 100644 --- a/src/blogc-git-receiver/pre-receive.c +++ b/src/blogc-git-receiver/pre-receive.c @@ -125,6 +125,11 @@ bgr_pre_receive_hook(int argc, char *argv[]) } const char *sym_tmp = bc_config_get(config, section, "symlink"); + if (sym_tmp == NULL) { + bc_config_free(config); + goto default_sym; + } + sym = bc_str_starts_with(sym_tmp, "/") ? bc_strdup(sym_tmp) : bc_strdup_printf("%s/%s", repo_dir, sym_tmp); free(section); |