mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-03 21:10:30 +00:00
Shell: Error out on invalid `export' argument
Previously `export =` would crash the shell, make this an error instead.
This commit is contained in:
parent
a5c47d0be3
commit
56b5b78d7b
Notes:
sideshowbarker
2024-07-16 23:13:25 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/56b5b78d7b Pull-request: https://github.com/SerenityOS/serenity/pull/17756 Reviewed-by: https://github.com/kleinesfilmroellchen ✅
1 changed files with 4 additions and 0 deletions
|
@ -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]));
|
||||
|
|
Loading…
Reference in a new issue