diff options
author | Andreas Kling <kling@serenityos.org> | 2023-03-07 09:42:20 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-03-07 09:42:20 +0100 |
commit | 4797fad91c35f23aeabdaeb49dbe817a36ba44ed (patch) | |
tree | 8f5b5e0548615e0d8bccf4ba9d5effddf59c53a4 /Userland/Shell/AST.cpp | |
parent | 2258fc273c9eb0db404a8020b8621fab31d1f7f7 (diff) | |
download | serenity-4797fad91c35f23aeabdaeb49dbe817a36ba44ed.zip |
Shell: Fix bogus C-style casts from `NonnullOwnPtr<T>*` to `T*`
Thanks UBSAN for spotting this!
Diffstat (limited to 'Userland/Shell/AST.cpp')
-rw-r--r-- | Userland/Shell/AST.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Shell/AST.cpp b/Userland/Shell/AST.cpp index ca53f40cfd..e675ca2fee 100644 --- a/Userland/Shell/AST.cpp +++ b/Userland/Shell/AST.cpp @@ -49,7 +49,7 @@ ErrorOr<void> AK::Formatter<Shell::AST::Command>::format(FormatBuilder& builder, for (auto& redir : value.redirections) { TRY(builder.put_padding(' ', 1)); if (redir->is_path_redirection()) { - auto path_redir = (Shell::AST::PathRedirection const*)&redir; + auto path_redir = static_cast<Shell::AST::PathRedirection const*>(redir.ptr()); TRY(builder.put_i64(path_redir->fd)); switch (path_redir->direction) { case Shell::AST::PathRedirection::Read: @@ -67,12 +67,12 @@ ErrorOr<void> AK::Formatter<Shell::AST::Command>::format(FormatBuilder& builder, } TRY(builder.put_literal(path_redir->path)); } else if (redir->is_fd_redirection()) { - auto* fdredir = (Shell::AST::FdRedirection const*)&redir; + auto* fdredir = static_cast<Shell::AST::FdRedirection const*>(redir.ptr()); TRY(builder.put_i64(fdredir->new_fd)); TRY(builder.put_literal(">"sv)); TRY(builder.put_i64(fdredir->old_fd)); } else if (redir->is_close_redirection()) { - auto close_redir = (Shell::AST::CloseRedirection const*)&redir; + auto close_redir = static_cast<Shell::AST::CloseRedirection const*>(redir.ptr()); TRY(builder.put_i64(close_redir->fd)); TRY(builder.put_literal(">&-"sv)); } else { |