The following issues were found

Userland/Libraries/LibGUI/FileSystemModel.cpp
1 issues
access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 68 Column: 35 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                  }

    if (S_ISDIR(mode)) {
        is_accessible_directory = access(full_path.characters(), R_OK | X_OK) == 0;
    }

    return true;
}


            

Reported by FlawFinder.

Kernel/Bus/VirtIO/VirtIO.h
1 issues
read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 100 Column: 11 CWE codes: 120 20

                      size_t size { 0 };

        template<typename T>
        T read(u32 offset) const
        {
            if (!base)
                return 0;
            VERIFY(size >= sizeof(T));
            VERIFY(offset + sizeof(T) <= size);

            

Reported by FlawFinder.

Userland/Libraries/LibGUI/Notification.cpp
1 issues
There is an unknown macro here somewhere. Configuration is required. If C_OBJECT is a macro then please configure it.
Error

Line: 17

              class NotificationServerConnection final
    : public IPC::ServerConnection<NotificationClientEndpoint, NotificationServerEndpoint>
    , public NotificationClientEndpoint {
    C_OBJECT(NotificationServerConnection)

    friend class Notification;

public:
    virtual void die() override

            

Reported by Cppcheck.

Userland/Utilities/utmpupdate.cpp
1 issues
open - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 52 Column: 38 CWE codes: 362

              
    dbgln("Updating utmp from UID={} GID={} EGID={} PID={}", getuid(), getgid(), getegid(), pid);

    auto file_or_error = Core::File::open("/var/run/utmp", Core::OpenMode::ReadWrite);
    if (file_or_error.is_error()) {
        dbgln("Error: {}", file_or_error.error());
        return 1;
    }


            

Reported by FlawFinder.

Kernel/TTY/MasterPTY.h
1 issues
read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 38 Column: 31 CWE codes: 120 20

              private:
    explicit MasterPTY(unsigned index, NonnullOwnPtr<DoubleBuffer> buffer);
    // ^CharacterDevice
    virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override;
    virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
    virtual bool can_read(const FileDescription&, size_t) const override;
    virtual bool can_write(const FileDescription&, size_t) const override;
    virtual KResult close() override;
    virtual bool is_master_pty() const override { return true; }

            

Reported by FlawFinder.

Userland/Libraries/LibGUI/TreeView.h
1 issues
open - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 72 Column: 72 CWE codes: 362

                  struct MetadataForIndex;

    MetadataForIndex& ensure_metadata_for_index(const ModelIndex&) const;
    void set_open_state_of_all_in_subtree(const ModelIndex& root, bool open);

    mutable HashMap<void*, NonnullOwnPtr<MetadataForIndex>> m_view_metadata;

    RefPtr<Gfx::Bitmap> m_expand_bitmap;
    RefPtr<Gfx::Bitmap> m_collapse_bitmap;

            

Reported by FlawFinder.

Userland/Libraries/LibGUI/VimEditingEngine.cpp
1 issues
strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 138 Column: 13 CWE codes: 126

                      // from the keycode itself.
        char const* keycode_str = key_code_to_string(key);

        if (strlen(keycode_str) == 1 && (isalpha(keycode_str[0]) || isspace(keycode_str[0]))) {
            m_next_character = tolower(keycode_str[0]);
            m_unit = Unit::Find;
        } else {
            m_unit = Unit::Unknown;
        }

            

Reported by FlawFinder.

Userland/Utilities/w.cpp
1 issues
open - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 46 Column: 38 CWE codes: 362

              
    unveil(nullptr, nullptr);

    auto file_or_error = Core::File::open("/var/run/utmp", Core::OpenMode::ReadOnly);
    if (file_or_error.is_error()) {
        warnln("Error: {}", file_or_error.error());
        return 1;
    }
    auto& file = *file_or_error.value();

            

Reported by FlawFinder.

Kernel/Syscalls/umask.cpp
1 issues
umask - Ensure that umask is given most restrictive possible setting (e.g., 066 or 077)
Security

Line: 15 Column: 40 CWE codes: 732

              {
    VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
    REQUIRE_PROMISE(stdio);
    auto old_mask = m_protected_values.umask;
    ProtectedDataMutationScope scope { *this };
    m_protected_values.umask = mask & 0777;
    return old_mask;
}


            

Reported by FlawFinder.

Userland/Utilities/nproc.cpp
1 issues
open - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 20 Column: 16 CWE codes: 362

                  }

    auto file = Core::File::construct("/proc/cpuinfo");
    if (!file->open(Core::OpenMode::ReadOnly)) {
        perror("Core::File::open()");
        return 1;
    }

    auto json = JsonValue::from_string({ file->read_all() });

            

Reported by FlawFinder.