Check whether mcs output name is valid
[mono.git] / mcs / mcs / driver.cs
index d3e2f2fad09f57090cad658bab5c3dce09bcaf1d..cd42b8974c631cd7efc4a86f15b8153f2090933b 100644 (file)
@@ -256,6 +256,12 @@ namespace Mono.CSharp
                                output_file = output_file_name;
                        } else {
                                output_file_name = Path.GetFileName (output_file);
+
+                               if (string.IsNullOrEmpty (Path.GetFileNameWithoutExtension (output_file_name)) ||
+                                       output_file_name.IndexOfAny (Path.GetInvalidFileNameChars ()) >= 0) {
+                                       Report.Error (2021, "Output file name is not valid");
+                                       return false;
+                               }
                        }
 
 #if STATIC