The following issues were found

Userland/Applications/SystemMonitor/main.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: 613 Column: 40 CWE codes: 362

              
            auto& pci_table_view = pci_group_box.add<GUI::TableView>();

            auto db = PCIDB::Database::open();
            if (!db)
                warnln("Couldn't open PCI ID database!");

            Vector<GUI::JsonArrayModel::FieldSpec> pci_fields;
            pci_fields.empend(

            

Reported by FlawFinder.

Userland/Applications/SystemMonitor/MemoryStatsWidget.h
1 issues
There is an unknown macro here somewhere. Configuration is required. If C_OBJECT is a macro then please configure it.
Error

Line: 14

              class GraphWidget;

class MemoryStatsWidget final : public GUI::Widget {
    C_OBJECT(MemoryStatsWidget)
public:
    static MemoryStatsWidget* the();

    virtual ~MemoryStatsWidget() override;


            

Reported by Cppcheck.

Userland/Applications/SystemMonitor/MemoryStatsWidget.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: 77 Column: 24 CWE codes: 362

              void MemoryStatsWidget::refresh()
{
    auto proc_memstat = Core::File::construct("/proc/memstat");
    if (!proc_memstat->open(Core::OpenMode::ReadOnly))
        VERIFY_NOT_REACHED();

    auto file_contents = proc_memstat->read_all();
    auto json_result = JsonValue::from_string(file_contents);
    VERIFY(json_result.has_value());

            

Reported by FlawFinder.

Userland/Applications/TextEditor/main.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: 113 Column: 37 CWE codes: 362

                      // A file name was passed, parse any possible line and column numbers included.
        FileArgument parsed_argument(file_to_edit);
        if (Core::File::exists(file_to_edit_full_path)) {
            auto file = Core::File::open(file_to_edit_full_path, Core::OpenMode::ReadOnly);

            if (file.is_error()) {
                GUI::MessageBox::show_error(window, String::formatted("Opening \"{}\" failed: {}", file_to_edit_full_path, file.error()));
                return 1;
            }

            

Reported by FlawFinder.

Userland/Applications/Spreadsheet/Spreadsheet.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: 49 Column: 38 CWE codes: 362

                  global_object().define_direct_property("thisSheet", &global_object(), JS::default_attributes); // Self-reference is unfortunate, but required.

    // Sadly, these have to be evaluated once per sheet.
    auto file_or_error = Core::File::open("/res/js/Spreadsheet/runtime.js", Core::OpenMode::ReadOnly);
    if (!file_or_error.is_error()) {
        auto buffer = file_or_error.value()->read_all();
        JS::Parser parser { JS::Lexer(buffer) };
        if (parser.has_errors()) {
            warnln("Spreadsheet: Failed to parse runtime code");

            

Reported by FlawFinder.

Userland/Demos/Cube/Cube.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: 30

              static bool flag_hide_window_frame = false;

class Cube final : public GUI::Widget {
    C_OBJECT(Cube)
public:
    virtual ~Cube() override;
    void set_stat_label(RefPtr<GUI::Label> l) { m_stats = l; };
    void set_show_window_frame(bool);
    bool show_window_frame() const { return m_show_window_frame; }

            

Reported by Cppcheck.

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

Line: 27 Column: 31 CWE codes: 120 20

                  FullDevice();

    // ^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 { return true; }
    virtual StringView class_name() const override { return "FullDevice"; }
};

            

Reported by FlawFinder.

Userland/Demos/Fire/Fire.cpp
1 issues
srand - This function is not sufficiently random for security-related functions such as key and nonce creation
Security

Line: 99 Column: 5 CWE codes: 327
Suggestion: Use a more secure technique for acquiring random values

                  cycles = 0;
    phase = 0;

    srand(time(nullptr));
    stop_timer();
    start_timer(20);

    /* Draw fire "source" on bottom row of pixels */
    for (int i = 0; i < FIRE_WIDTH; i++)

            

Reported by FlawFinder.

Userland/Demos/LibGfxDemo/main.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: 25

              const int HEIGHT = 600;

class Canvas final : public GUI::Widget {
    C_OBJECT(Canvas)
public:
    virtual ~Canvas() override;

private:
    Canvas();

            

Reported by Cppcheck.

Userland/Demos/LibGfxScaleDemo/main.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: 28

              const int HEIGHT = 200;

class Canvas final : public GUI::Widget {
    C_OBJECT(Canvas)
public:
    virtual ~Canvas() override;

private:
    Canvas();

            

Reported by Cppcheck.