summaryrefslogtreecommitdiffstats
path: root/src/openvpn/options.c
diff options
context:
space:
mode:
authorSteffan Karger <steffan@karger.me>2015-09-21 20:48:33 +0200
committerGert Doering <gert@greenie.muc.de>2015-10-04 21:58:06 +0200
commit6d4920e9d36675ff515da17c1eb301d22d07b489 (patch)
tree419f752e1c0176146a5c230426f6ada452b10f57 /src/openvpn/options.c
parent60287662bbdb1a29d9bd6244917a050410fa6b49 (diff)
downloadopenvpn-6d4920e9d36675ff515da17c1eb301d22d07b489.tar.gz
openvpn-6d4920e9d36675ff515da17c1eb301d22d07b489.tar.xz
openvpn-6d4920e9d36675ff515da17c1eb301d22d07b489.zip
Replace strdup() calls for string_alloc() calls
As reported by Bill Parker in trac #600, strdup() return values are not always correctly checked for failed allocations. This patch adds missing checks by using string_alloc(), which performs the required checks. Signed-off-by: Steffan Karger <steffan@karger.me> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <561130FC.8090008@karger.me> URL: http://article.gmane.org/gmane.network.openvpn.devel/10176 Signed-off-by: Gert Doering <gert@greenie.muc.de> (cherry picked from commit ddc7692d245017c71adc40ad5cc195617e39fce0)
Diffstat (limited to 'src/openvpn/options.c')
-rw-r--r--src/openvpn/options.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index 7ff5f77..019ae6c 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -2617,7 +2617,7 @@ check_file_access(const int type, const char *file, const int mode, const char *
/* Is the directory path leading to the given file accessible? */
if (type & CHKACC_DIRPATH)
{
- char *fullpath = strdup(file); /* POSIX dirname() implementaion may modify its arguments */
+ char *fullpath = string_alloc (file, NULL); /* POSIX dirname() implementaion may modify its arguments */
char *dirpath = dirname(fullpath);
if (platform_access (dirpath, mode|X_OK) != 0)