The following issues were found
Userland/Applications/Browser/BookmarksBarWidget.cpp
1 issues
Line: 27
namespace {
class BookmarkEditor final : public GUI::Dialog {
C_OBJECT(BookmarkEditor)
public:
static Vector<JsonValue>
edit_bookmark(Window* parent_window, const StringView& title, const StringView& url)
{
Reported by Cppcheck.
Userland/Libraries/LibC/strings.cpp
1 issues
Line: 19
Column: 6
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
memset(dest, 0, n);
}
void bcopy(const void* src, void* dest, size_t n)
{
memmove(dest, src, n);
}
static char foldcase(char ch)
Reported by FlawFinder.
Userland/Libraries/LibC/strings.h
1 issues
Line: 17
Column: 6
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
int strcasecmp(const char*, const char*);
int strncasecmp(const char*, const char*, size_t);
void bzero(void*, size_t);
void bcopy(const void*, void*, size_t);
__END_DECLS
Reported by FlawFinder.
Kernel/CMOS.cpp
1 issues
Userland/Libraries/LibC/sys/socket.cpp
1 issues
Line: 95
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
msghdr msg = { addr ? &internal_addr : nullptr, addr ? (socklen_t)sizeof(internal_addr) : 0, &iov, 1, nullptr, 0, 0 };
ssize_t rc = recvmsg(sockfd, &msg, flags);
if (rc >= 0 && addr) {
memcpy(addr, &internal_addr, min(*addr_length, msg.msg_namelen));
*addr_length = msg.msg_namelen;
}
return rc;
}
Reported by FlawFinder.
Userland/Utilities/ls.cpp
1 issues
Line: 225
Column: 9
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
{
static String s_hostname;
if (s_hostname.is_null()) {
char buffer[HOST_NAME_MAX];
if (gethostname(buffer, sizeof(buffer)) == 0)
s_hostname = buffer;
else
s_hostname = "localhost";
}
Reported by FlawFinder.
Userland/Libraries/LibC/sys/statvfs.cpp
1 issues
Line: 16
Column: 49
CWE codes:
126
int statvfs(const char* path, struct statvfs* buf)
{
Syscall::SC_statvfs_params params { { path, strlen(path) }, buf };
int rc = syscall(SC_statvfs, ¶ms);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
int fstatvfs(int fd, struct statvfs* buf)
Reported by FlawFinder.
Userland/Utilities/lsirq.cpp
1 issues
Line: 30
Column: 27
CWE codes:
362
unveil(nullptr, nullptr);
auto proc_interrupts = Core::File::construct("/proc/interrupts");
if (!proc_interrupts->open(Core::OpenMode::ReadOnly)) {
warnln("Error: {}", proc_interrupts->error_string());
return 1;
}
if (pledge("stdio", nullptr) < 0) {
Reported by FlawFinder.
Userland/Libraries/LibC/syslog.h
1 issues
Line: 149
Column: 6
CWE codes:
134
Suggestion:
Use a constant format string for syslog
#endif
/* The re-entrant versions are an OpenBSD extension we also implement. */
void syslog(int, const char*, ...);
void syslog_r(int, struct syslog_data*, const char*, ...);
void vsyslog(int, const char* message, va_list);
void vsyslog_r(int, struct syslog_data* data, const char* message, va_list);
void openlog(const char*, int, int);
void openlog_r(const char*, int, int, struct syslog_data*);
Reported by FlawFinder.
Userland/Applications/Assistant/main.cpp
1 issues
Line: 36
};
class ResultRow final : public GUI::Widget {
C_OBJECT(ResultRow)
public:
ResultRow()
{
auto& layout = set_layout<GUI::HorizontalBoxLayout>();
layout.set_spacing(12);
Reported by Cppcheck.