From 26beedd70c619c7b83607f6a96404abfafcaeaf1 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Tue, 5 Jan 2016 21:48:03 +0100 Subject: [PATCH] ocserv: prevent a crash if the per-user dir does not exist Relates #2167 --- net/ocserv/Makefile | 2 +- ...t-to-open-per_user_dir-if-it-is-NULL.patch | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 net/ocserv/patches/0001-don-t-attempt-to-open-per_user_dir-if-it-is-NULL.patch diff --git a/net/ocserv/Makefile b/net/ocserv/Makefile index c8988df92b..ac90a55057 100644 --- a/net/ocserv/Makefile +++ b/net/ocserv/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ocserv PKG_VERSION:=0.10.10 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_USE_MIPS16:=0 PKG_BUILD_DIR :=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) diff --git a/net/ocserv/patches/0001-don-t-attempt-to-open-per_user_dir-if-it-is-NULL.patch b/net/ocserv/patches/0001-don-t-attempt-to-open-per_user_dir-if-it-is-NULL.patch new file mode 100644 index 0000000000..513d766a2f --- /dev/null +++ b/net/ocserv/patches/0001-don-t-attempt-to-open-per_user_dir-if-it-is-NULL.patch @@ -0,0 +1,37 @@ +From 78ebe6c1dab648e3190363cb38ad5be356884494 Mon Sep 17 00:00:00 2001 +From: Nikos Mavrogiannopoulos +Date: Tue, 5 Jan 2016 21:37:35 +0100 +Subject: [PATCH] don't attempt to open per_user_dir if it is NULL + +This addresses a crash in certain libc's. +--- + src/config.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/config.c b/src/config.c +index 827a7a0..50db655 100644 +--- a/src/config.c ++++ b/src/config.c +@@ -617,6 +617,9 @@ static void load_iroutes(struct cfg_st *config) + struct dirent *r; + char path[_POSIX_PATH_MAX]; + ++ if (config->per_user_dir == NULL) ++ return; ++ + dir = opendir(config->per_user_dir); + if (dir != NULL) { + do { +@@ -626,8 +629,8 @@ static void load_iroutes(struct cfg_st *config) + append_iroutes_from_file(config, path); + } + } while(r != NULL); ++ closedir(dir); + } +- closedir(dir); + } + + static void parse_cfg_file(void *pool, const char* file, struct perm_cfg_st *perm_config, unsigned reload) +-- +2.5.1 + -- 2.30.2