This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Replace repetitive code in lib/File/stat.t with a data driven loop.
[perl5.git] / ext / DynaLoader / dl_win32.xs
index 60ec703..94b3fe3 100644 (file)
@@ -72,6 +72,10 @@ dl_static_linked(char *filename)
     static char subStr[] = "/auto/";
     char szBuffer[MAX_PATH];
 
+    /* avoid buffer overflow when called with invalid filenames */
+    if (strlen(filename) >= sizeof(szBuffer))
+        return 0;
+
     /* change all the '\\' to '/' */
     strcpy(szBuffer, filename);
     for(ptr = szBuffer; ptr = strchr(ptr, '\\'); ++ptr)