Browse Source

ocserv: prevent a crash if the per-user dir does not exist

Relates #2167
Nikos Mavrogiannopoulos 9 years ago
parent
commit
26beedd70c

+ 1
- 1
net/ocserv/Makefile View File

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
9 9
 
10 10
 PKG_NAME:=ocserv
11 11
 PKG_VERSION:=0.10.10
12
-PKG_RELEASE:=3
12
+PKG_RELEASE:=4
13 13
 PKG_USE_MIPS16:=0
14 14
 
15 15
 PKG_BUILD_DIR :=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

+ 37
- 0
net/ocserv/patches/0001-don-t-attempt-to-open-per_user_dir-if-it-is-NULL.patch View File

@@ -0,0 +1,37 @@
1
+From 78ebe6c1dab648e3190363cb38ad5be356884494 Mon Sep 17 00:00:00 2001
2
+From: Nikos Mavrogiannopoulos <nmav@gnutls.org>
3
+Date: Tue, 5 Jan 2016 21:37:35 +0100
4
+Subject: [PATCH] don't attempt to open per_user_dir if it is NULL
5
+
6
+This addresses a crash in certain libc's.
7
+---
8
+ src/config.c | 5 ++++-
9
+ 1 file changed, 4 insertions(+), 1 deletion(-)
10
+
11
+diff --git a/src/config.c b/src/config.c
12
+index 827a7a0..50db655 100644
13
+--- a/src/config.c
14
++++ b/src/config.c
15
+@@ -617,6 +617,9 @@ static void load_iroutes(struct cfg_st *config)
16
+ 	struct dirent *r;
17
+ 	char path[_POSIX_PATH_MAX];
18
+ 
19
++	if (config->per_user_dir == NULL)
20
++		return;
21
++
22
+ 	dir = opendir(config->per_user_dir);
23
+ 	if (dir != NULL) {
24
+ 		do {
25
+@@ -626,8 +629,8 @@ static void load_iroutes(struct cfg_st *config)
26
+ 				append_iroutes_from_file(config, path);
27
+ 			}
28
+ 		} while(r != NULL);
29
++		closedir(dir);
30
+ 	}
31
+-	closedir(dir);
32
+ }
33
+ 
34
+ static void parse_cfg_file(void *pool, const char* file, struct perm_cfg_st *perm_config, unsigned reload)
35
+-- 
36
+2.5.1
37
+