The following issues were found
Userland/Libraries/LibC/fcntl.h
1 issues
Line: 15
Column: 5
CWE codes:
362
__BEGIN_DECLS
int creat(const char* path, mode_t);
int open(const char* path, int options, ...);
int openat(int dirfd, const char* path, int options, ...);
int fcntl(int fd, int cmd, ...);
int create_inode_watcher(unsigned flags);
int inode_watcher_add_watch(int fd, const char* path, size_t path_length, unsigned event_mask);
Reported by FlawFinder.
Userland/Libraries/LibC/fd_set.h
1 issues
Line: 16
Column: 14
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
#define FD_ISSET(fd, set) ((set)->bits[(fd / 8)] & (1 << (fd) % 8))
struct __fd_set {
unsigned char bits[FD_SETSIZE / 8];
};
typedef struct __fd_set fd_set;
Reported by FlawFinder.
Userland/Applications/HexEditor/HexEditor.cpp
1 issues
Line: 88
Column: 14
CWE codes:
362
if (m_buffer.is_empty())
return true;
int fd = open(path.characters(), O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (fd < 0) {
perror("open");
return false;
}
Reported by FlawFinder.
Userland/Libraries/LibC/getopt.h
1 issues
Line: 29
Column: 5
CWE codes:
120
20
Suggestion:
Check implementation on installation, or limit the size of all string inputs
extern int optind;
extern int optreset;
extern char* optarg;
int getopt_long(int argc, char* const* argv, const char* short_options, const struct option* long_options, int* out_long_option_index);
__END_DECLS
Reported by FlawFinder.
Userland/Applications/Help/ManualSectionNode.h
1 issues
Line: 30
Column: 24
CWE codes:
362
virtual const ManualNode* parent() const override { return nullptr; }
virtual String name() const override { return m_full_name; }
virtual bool is_open() const override { return m_open; }
void set_open(bool open);
const String& section_name() const { return m_section; }
String path() const;
private:
Reported by FlawFinder.
Userland/Utilities/ini.cpp
1 issues
Line: 37
Column: 37
CWE codes:
362
return 1;
}
auto config = Core::ConfigFile::open(path);
if (value_to_write) {
config->write_entry(group, key, value_to_write);
config->sync();
return 0;
Reported by FlawFinder.
Userland/Utilities/jp.cpp
1 issues
Line: 44
Column: 16
CWE codes:
362
if (path == nullptr)
path = "/dev/stdin";
auto file = Core::File::construct(path);
if (!file->open(Core::OpenMode::ReadOnly)) {
warnln("Couldn't open {} for reading: {}", path, file->error_string());
return 1;
}
if (pledge("stdio", nullptr) < 0) {
Reported by FlawFinder.
Userland/Applications/FontEditor/NewFontDialog.cpp
1 issues
Line: 31
namespace GUI {
class GlyphPreviewWidget final : public Frame {
C_OBJECT(GlyphPreviewWidget)
public:
void set_preview_size(int width, int height)
{
m_width = width;
m_height = height;
Reported by Cppcheck.
Userland/Libraries/LibC/mallocdefs.h
1 issues
Line: 66
Column: 35
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
size_t m_next_lazy_freelist_index { 0 };
FreelistEntry* m_freelist { nullptr };
size_t m_free_chunks { 0 };
[[gnu::aligned(16)]] unsigned char m_slot[0];
void* chunk(size_t index)
{
return &m_slot[index * m_size];
}
Reported by FlawFinder.
Userland/Applications/FontEditor/GlyphMapWidget.h
1 issues
Line: 13
#include <LibGfx/BitmapFont.h>
class GlyphMapWidget final : public GUI::AbstractScrollableWidget {
C_OBJECT(GlyphMapWidget)
public:
virtual ~GlyphMapWidget() override;
void initialize(Gfx::BitmapFont&);
Reported by Cppcheck.