The following issues were found
Userland/Applications/Piano/AudioPlayerLoop.h
2 issues
Line: 20
// Wrapper class accepting custom events to advance the track playing and forward audio data to the system.
// This does not run on a separate thread, preventing IPC multithreading madness.
class AudioPlayerLoop : public Core::Object {
C_OBJECT(AudioPlayerLoop)
public:
AudioPlayerLoop(TrackManager& track_manager, bool& need_to_write_wav, Audio::WavWriter& wav_writer);
void enqueue_audio();
Reported by Cppcheck.
Line: 20
// Wrapper class accepting custom events to advance the track playing and forward audio data to the system.
// This does not run on a separate thread, preventing IPC multithreading madness.
class AudioPlayerLoop : public Core::Object {
C_OBJECT(AudioPlayerLoop)
public:
AudioPlayerLoop(TrackManager& track_manager, bool& need_to_write_wav, Audio::WavWriter& wav_writer);
void enqueue_audio();
Reported by Cppcheck.
Kernel/StdLib.h
2 issues
Line: 43
Column: 7
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
[[nodiscard]] bool copy_from_user(void*, const void*, size_t);
[[nodiscard]] bool memset_user(void*, int, size_t);
void* memcpy(void*, const void*, size_t);
[[nodiscard]] int strncmp(const char* s1, const char* s2, size_t n);
[[nodiscard]] char* strstr(const char* haystack, const char* needle);
[[nodiscard]] int strcmp(char const*, const char*);
[[nodiscard]] size_t strlen(const char*);
[[nodiscard]] size_t strnlen(const char*, size_t);
Reported by FlawFinder.
Line: 47
Column: 22
CWE codes:
126
[[nodiscard]] int strncmp(const char* s1, const char* s2, size_t n);
[[nodiscard]] char* strstr(const char* haystack, const char* needle);
[[nodiscard]] int strcmp(char const*, const char*);
[[nodiscard]] size_t strlen(const char*);
[[nodiscard]] size_t strnlen(const char*, size_t);
void* memset(void*, int, size_t);
[[nodiscard]] int memcmp(const void*, const void*, size_t);
void* memmove(void* dest, const void* src, size_t n);
const void* memmem(const void* haystack, size_t, const void* needle, size_t);
Reported by FlawFinder.
Userland/Libraries/LibC/sys/mman.cpp
2 issues
Line: 18
Column: 112
CWE codes:
126
void* serenity_mmap(void* addr, size_t size, int prot, int flags, int fd, off_t offset, size_t alignment, const char* name)
{
Syscall::SC_mmap_params params { (uintptr_t)addr, size, alignment, prot, flags, fd, offset, { name, name ? strlen(name) : 0 } };
ptrdiff_t rc = syscall(SC_mmap, ¶ms);
if (rc < 0 && rc > -EMAXERRNO) {
errno = -rc;
return MAP_FAILED;
}
Reported by FlawFinder.
Line: 66
Column: 67
CWE codes:
126
errno = EFAULT;
return -1;
}
Syscall::SC_set_mmap_name_params params { addr, size, { name, strlen(name) } };
int rc = syscall(SC_set_mmap_name, ¶ms);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
int madvise(void* address, size_t size, int advice)
Reported by FlawFinder.
Userland/Games/Hearts/Game.h
2 issues
Line: 20
namespace Hearts {
class Game final : public GUI::Frame {
C_OBJECT(Game)
public:
static constexpr int width = 640;
static constexpr int height = 480;
virtual ~Game() override;
Reported by Cppcheck.
Line: 20
namespace Hearts {
class Game final : public GUI::Frame {
C_OBJECT(Game)
public:
static constexpr int width = 640;
static constexpr int height = 480;
virtual ~Game() override;
Reported by Cppcheck.
Userland/Applications/MouseSettings/MouseSettingsWindow.h
2 issues
Line: 17
#include <LibGUI/Window.h>
class MouseSettingsWindow final : public GUI::Window {
C_OBJECT(MouseSettingsWindow)
public:
virtual ~MouseSettingsWindow() override;
private:
MouseSettingsWindow();
Reported by Cppcheck.
Line: 17
#include <LibGUI/Window.h>
class MouseSettingsWindow final : public GUI::Window {
C_OBJECT(MouseSettingsWindow)
public:
virtual ~MouseSettingsWindow() override;
private:
MouseSettingsWindow();
Reported by Cppcheck.
Userland/Games/Minesweeper/Field.h
2 issues
Line: 41
};
class Field final : public GUI::Frame {
C_OBJECT(Field)
friend class Square;
friend class SquareLabel;
public:
Field(GUI::Label& flag_label, GUI::Label& time_label, GUI::Button& face_button, Function<void(Gfx::IntSize)> on_size_changed);
Reported by Cppcheck.
Line: 41
};
class Field final : public GUI::Frame {
C_OBJECT(Field)
friend class Square;
friend class SquareLabel;
public:
Field(GUI::Label& flag_label, GUI::Label& time_label, GUI::Button& face_button, Function<void(Gfx::IntSize)> on_size_changed);
Reported by Cppcheck.
Userland/Libraries/LibC/sys/stat.h
2 issues
Line: 17
Column: 5
CWE codes:
362
Suggestion:
Use fchmod( ) instead
__BEGIN_DECLS
mode_t umask(mode_t);
int chmod(const char* pathname, mode_t);
int fchmod(int fd, mode_t);
int mkdir(const char* pathname, mode_t);
int mkfifo(const char* pathname, mode_t);
int fstat(int fd, struct stat* statbuf);
int lstat(const char* path, struct stat* statbuf);
Reported by FlawFinder.
Line: 16
Column: 8
CWE codes:
732
__BEGIN_DECLS
mode_t umask(mode_t);
int chmod(const char* pathname, mode_t);
int fchmod(int fd, mode_t);
int mkdir(const char* pathname, mode_t);
int mkfifo(const char* pathname, mode_t);
int fstat(int fd, struct stat* statbuf);
Reported by FlawFinder.
Userland/Games/Solitaire/Game.h
2 issues
Line: 32
};
class Game final : public GUI::Frame {
C_OBJECT(Game)
public:
static constexpr int width = 640;
static constexpr int height = 480;
virtual ~Game() override;
Reported by Cppcheck.
Line: 32
};
class Game final : public GUI::Frame {
C_OBJECT(Game)
public:
static constexpr int width = 640;
static constexpr int height = 480;
virtual ~Game() override;
Reported by Cppcheck.
Userland/Applications/MailSettings/MailSettingsWindow.h
2 issues
Line: 13
#include <LibGUI/Window.h>
class MailSettingsWindow final : public GUI::Window {
C_OBJECT(MailSettingsWindow)
private:
MailSettingsWindow();
void reset_default_values();
Reported by Cppcheck.
Line: 13
#include <LibGUI/Window.h>
class MailSettingsWindow final : public GUI::Window {
C_OBJECT(MailSettingsWindow)
private:
MailSettingsWindow();
void reset_default_values();
Reported by Cppcheck.
Userland/Applications/Mail/MailWidget.cpp
2 issues
Line: 446
}
fetch_command = IMAP::FetchCommand {
.sequence_set { { id_of_email_to_load, id_of_email_to_load } },
.data_items = {
IMAP::FetchCommand::DataItem {
.type = IMAP::FetchCommand::DataItemType::BodySection,
.section = IMAP::FetchCommand::DataItem::Section {
.type = IMAP::FetchCommand::DataItem::SectionType::Parts,
Reported by Cppcheck.
Line: 41
Column: 33
CWE codes:
362
};
m_web_view->on_link_click = [this](auto& url, auto&, unsigned) {
if (!Desktop::Launcher::open(url)) {
GUI::MessageBox::show(
window(),
String::formatted("The link to '{}' could not be opened.", url),
"Failed to open link",
GUI::MessageBox::Type::Error);
Reported by FlawFinder.