From 5f9913570acc6814e11f6f04fdb7d79953530d5e Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Thu, 4 Jul 2013 14:09:05 +0200 Subject: [PATCH] std: Handle NULL pointer argument in c_dir() correctly. --- src/std/c_dir.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/std/c_dir.c b/src/std/c_dir.c index 0dfc5d3db..0a9c96343 100644 --- a/src/std/c_dir.c +++ b/src/std/c_dir.c @@ -178,8 +178,10 @@ int c_isdir(const char *path) { mbchar_t *wpath = c_utf8_to_locale(path); int re = 0; - if (_tstat (wpath, &sb) == 0 && S_ISDIR(sb.st_mode)) { - re = 1; + if (path != NULL) { + if (_tstat (wpath, &sb) == 0 && S_ISDIR(sb.st_mode)) { + re = 1; + } } c_free_locale_string(wpath); return re;