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
authorGurusamy Sarathy <gsar@cpan.org>
Sat, 22 Sep 2001 23:18:47 +0000 (23:18 +0000)
committerGurusamy Sarathy <gsar@cpan.org>
Sat, 22 Sep 2001 23:18:47 +0000 (23:18 +0000)
p4raw-id: //depot/maint-5.6/perl@12146

win32/perlhost.h
win32/win32.c

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));
index 4464c5f..682b133 100644 (file)
@@ -2974,6 +2974,10 @@ DllExport int
 win32_chdir(const char *dir)
 {
     dTHXo;
+    if (!dir) {
+       errno = ENOENT;
+       return -1;
+    }
     if (USING_WIDE()) {
        WCHAR wBuffer[MAX_PATH+1];
        A2WHELPER(dir, wBuffer, sizeof(wBuffer));