This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
win32_chdir() et al don't handle a NULL argument gracefully
[perl5.git] / win32 / perlhost.h
index 8660abd..ca5b498 100644 (file)
@@ -2351,6 +2351,10 @@ CPerlHost::Chdir(const char *dirname)
 {
     dTHXo;
     int ret;
+    if (!dirname) {
+       errno = ENOENT;
+       return -1;
+    }
     if (USING_WIDE()) {
        WCHAR wBuffer[MAX_PATH];
        A2WHELPER(dirname, wBuffer, sizeof(wBuffer));