The following issues were found
Userland/Utilities/hexdump.cpp
1 issues
Line: 25
Column: 42
CWE codes:
362
if (!path) {
file = Core::File::standard_input();
} else {
auto file_or_error = Core::File::open(path, Core::OpenMode::ReadOnly);
if (file_or_error.is_error()) {
warnln("Failed to open {}: {}", path, file_or_error.error());
return 1;
}
file = file_or_error.value();
Reported by FlawFinder.
Userland/Utilities/host.cpp
1 issues
Line: 51
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
return 1;
}
char buffer[INET_ADDRSTRLEN];
const char* ip_str = inet_ntop(AF_INET, hostent->h_addr_list[0], buffer, sizeof(buffer));
outln("{} is {}", name_or_ip, ip_str);
return 0;
}
Reported by FlawFinder.
Userland/Applications/Piano/KnobsWidget.h
1 issues
Line: 16
class MainWidget;
class KnobsWidget final : public GUI::Frame {
C_OBJECT(KnobsWidget)
public:
virtual ~KnobsWidget() override;
void update_knobs();
Reported by Cppcheck.
Userland/Applications/PDFViewer/PDFViewerWidget.cpp
1 issues
Line: 109
Column: 36
CWE codes:
362
void PDFViewerWidget::open_file(const String& path)
{
window()->set_title(String::formatted("{} - PDF Viewer", path));
auto file_result = Core::File::open(path, Core::OpenMode::ReadOnly);
if (file_result.is_error()) {
GUI::MessageBox::show_error(nullptr, String::formatted("Couldn't open file: {}", path));
return;
}
Reported by FlawFinder.
Userland/Libraries/LibArchive/TarStream.h
1 issues
Line: 20
Column: 12
CWE codes:
120
20
class TarFileStream : public InputStream {
public:
size_t read(Bytes) override;
bool unreliable_eof() const override;
bool read_or_error(Bytes) override;
bool discard_or_error(size_t count) override;
Reported by FlawFinder.
Userland/Applications/PDFViewer/PDFViewer.h
1 issues
Line: 39
static constexpr size_t initial_zoom_level = 8;
class PDFViewer : public GUI::AbstractScrollableWidget {
C_OBJECT(PDFViewer)
public:
virtual ~PDFViewer() override = default;
ALWAYS_INLINE u32 current_page() const { return m_current_page_index; }
Reported by Cppcheck.
Userland/Applications/Mail/MailWidget.h
1 issues
Line: 18
#include <LibWeb/OutOfProcessWebView.h>
class MailWidget final : public GUI::Widget {
C_OBJECT(MailWidget)
public:
virtual ~MailWidget() override;
bool connect_and_login();
Reported by Cppcheck.
Userland/Libraries/LibAudio/Buffer.h
1 issues
Line: 143
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
, m_id(allocate_id())
, m_sample_count(samples.size())
{
memcpy(m_buffer.data<void>(), samples.data(), samples.size() * sizeof(Frame));
}
explicit Buffer(Core::AnonymousBuffer buffer, i32 buffer_id, int sample_count)
: m_buffer(move(buffer))
, m_id(buffer_id)
Reported by FlawFinder.
Userland/Libraries/LibAudio/ClientConnection.cpp
1 issues
Line: 25
Column: 9
CWE codes:
676
Suggestion:
Use nanosleep(2) or setitimer(2) instead
break;
// FIXME: We don't know what is a good value for this.
// For now, decrease it to enable better real-time audio.
usleep(10000);
}
}
void ClientConnection::async_enqueue(Buffer const& buffer)
{
Reported by FlawFinder.
Userland/Applications/KeyboardSettings/main.cpp
1 issues
Line: 70
Column: 23
CWE codes:
362
auto app_icon = GUI::Icon::default_icon("app-keyboard-settings");
auto proc_keymap = Core::File::construct("/proc/keymap");
if (!proc_keymap->open(Core::OpenMode::ReadOnly))
VERIFY_NOT_REACHED();
auto json = JsonValue::from_string(proc_keymap->read_all());
VERIFY(json.has_value());
JsonObject keymap_object = json.value().as_object();
Reported by FlawFinder.