diff options
author | Steffan Karger <steffan@karger.me> | 2015-09-21 20:48:33 +0200 |
---|---|---|
committer | Gert Doering <gert@greenie.muc.de> | 2015-10-04 21:55:29 +0200 |
commit | ddc7692d245017c71adc40ad5cc195617e39fce0 (patch) | |
tree | 2f5549f793513c854f289437d5446314719bf21f /src/openvpn/options.c | |
parent | c40f088e52132273f6d4e83d05fa64bbaedd860f (diff) | |
download | openvpn-ddc7692d245017c71adc40ad5cc195617e39fce0.tar.gz openvpn-ddc7692d245017c71adc40ad5cc195617e39fce0.tar.xz openvpn-ddc7692d245017c71adc40ad5cc195617e39fce0.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>
Diffstat (limited to 'src/openvpn/options.c')
-rw-r--r-- | src/openvpn/options.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 5ace1f3..de4fa38 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -2578,7 +2578,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) |