From 6d4920e9d36675ff515da17c1eb301d22d07b489 Mon Sep 17 00:00:00 2001 From: Steffan Karger Date: Mon, 21 Sep 2015 20:48:33 +0200 Subject: 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 Acked-by: Gert Doering Message-Id: <561130FC.8090008@karger.me> URL: http://article.gmane.org/gmane.network.openvpn.devel/10176 Signed-off-by: Gert Doering (cherry picked from commit ddc7692d245017c71adc40ad5cc195617e39fce0) --- src/openvpn/options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/openvpn/options.c') 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) -- cgit