The following issues were found

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

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

                      return 1;
    }

    srand(time(nullptr));

    auto app = GUI::Application::construct(argc, argv);
    auto app_icon = GUI::Icon::default_icon("app-2048");

    auto window = GUI::Window::construct();

            

Reported by FlawFinder.

Userland/Utilities/truncate.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: 78 Column: 14 CWE codes: 362

                      size = st.st_size;
    }

    int fd = open(file, O_RDWR | O_CREAT, 0666);
    if (fd < 0) {
        perror("open");
        return 1;
    }


            

Reported by FlawFinder.

Userland/Applications/Piano/PlayerWidget.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: 15

              class TrackManager;

class PlayerWidget final : public GUI::Toolbar {
    C_OBJECT(PlayerWidget)
public:
    virtual ~PlayerWidget() override;

private:
    explicit PlayerWidget(TrackManager&, AudioPlayerLoop&);

            

Reported by Cppcheck.

Userland/Utilities/gunzip.cpp
1 issues
read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 19 Column: 40 CWE codes: 120 20

                  u8 buffer[4096];

    while (!gzip_stream.has_any_error() && !gzip_stream.unreliable_eof()) {
        const auto nread = gzip_stream.read({ buffer, sizeof(buffer) });
        output_stream.write_or_error({ buffer, nread });
    }

    return !gzip_stream.handle_any_error();
}

            

Reported by FlawFinder.

Userland/Applications/Piano/MainWidget.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: 24

              class PlayerWidget;

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

    void add_actions(GUI::Menu&);


            

Reported by Cppcheck.

Userland/Utilities/gzip.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: 51 Column: 65 CWE codes: 362

                          auto stdout = Core::OutputFileStream { Core::File::standard_output() };
            success = stdout.write_or_error(compressed_file.value());
        } else {
            auto output_stream_result = Core::OutputFileStream::open(output_filename);
            if (output_stream_result.is_error()) {
                warnln("Failed opening output file for writing: {}", output_stream_result.error());
                return 1;
            }
            success = output_stream_result.value().write_or_error(compressed_file.value());

            

Reported by FlawFinder.

Userland/Games/Hearts/SettingsDialog.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: 13

              #include <LibGUI/Dialog.h>

class SettingsDialog : public GUI::Dialog {
    C_OBJECT(SettingsDialog)
public:
    String const& player_name() const { return m_player_name; }

private:
    SettingsDialog(GUI::Window* parent, String player_name);

            

Reported by Cppcheck.

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

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

                  , m_time_label(time_label)
    , m_on_size_changed(move(on_size_changed))
{
    srand(time(nullptr));
    m_timer = add<Core::Timer>();
    m_timer->on_timeout = [this] {
        ++m_time_elapsed;
        m_time_label.set_text(String::formatted("{}.{}", m_time_elapsed / 10, m_time_elapsed % 10));
    };

            

Reported by FlawFinder.

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

Line: 28 Column: 39 CWE codes: 120 20

                  // ^CharacterDevice
    virtual bool can_read(const Kernel::FileDescription&, size_t) const override;
    virtual bool can_write(const Kernel::FileDescription&, size_t) const override { return true; }
    virtual Kernel::KResultOr<size_t> read(FileDescription&, u64, Kernel::UserOrKernelBuffer&, size_t) override;
    virtual Kernel::KResultOr<size_t> write(FileDescription&, u64, const Kernel::UserOrKernelBuffer&, size_t) override;
    virtual StringView class_name() const override { return "Console"; }

    void put_char(char);


            

Reported by FlawFinder.

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

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

                  m_fruit_bitmaps.append(*Gfx::Bitmap::try_load_from_file("/res/icons/snake/eggplant.png"));
    m_fruit_bitmaps.append(*Gfx::Bitmap::try_load_from_file("/res/icons/snake/cauliflower.png"));
    m_fruit_bitmaps.append(*Gfx::Bitmap::try_load_from_file("/res/icons/snake/tomato.png"));
    srand(time(nullptr));
    reset();

    auto config = Core::ConfigFile::get_for_app("Snake");
    m_high_score = config->read_num_entry("Snake", "HighScore", 0);
    m_high_score_text = String::formatted("Best: {}", m_high_score);

            

Reported by FlawFinder.