diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2023-03-07 23:28:27 +0330 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2023-03-10 22:33:30 +0330 |
commit | 56b5b78d7b33a95d0c694b556c5c9e6bbccc82bd (patch) | |
tree | c2902a6b4d51752a7ff06f3a78cb727486a5540a /Userland/Shell/Builtin.cpp | |
parent | a5c47d0be3742187a73a8621ddc5d716967f36b3 (diff) | |
download | serenity-56b5b78d7b33a95d0c694b556c5c9e6bbccc82bd.zip |
Shell: Error out on invalid `export' argument
Previously `export =` would crash the shell, make this an error instead.
Diffstat (limited to 'Userland/Shell/Builtin.cpp')
-rw-r--r-- | Userland/Shell/Builtin.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Userland/Shell/Builtin.cpp b/Userland/Shell/Builtin.cpp index d9cc2a60ce..71900c33ca 100644 --- a/Userland/Shell/Builtin.cpp +++ b/Userland/Shell/Builtin.cpp @@ -541,6 +541,10 @@ ErrorOr<int> Shell::builtin_export(Main::Arguments arguments) for (auto& value : vars) { auto parts = value.split_limit('=', 2); + if (parts.is_empty()) { + warnln("Shell: Invalid export spec '{}', expected `variable=value' or `variable'", value); + return 1; + } if (parts.size() == 1) { auto value = TRY(lookup_local_variable(parts[0])); |