The following issues were found
Userland/Utilities/copy.cpp
1 issues
Line: 45
Column: 33
CWE codes:
362
} else if (text.is_empty()) {
// Copy our stdin.
auto c_stdin = Core::File::construct();
bool success = c_stdin->open(
STDIN_FILENO,
Core::OpenMode::ReadOnly,
Core::File::ShouldCloseFileDescriptor::No);
VERIFY(success);
auto buffer = c_stdin->read_all();
Reported by FlawFinder.
Userland/Utilities/cp.cpp
1 issues
Line: 38
Column: 9
CWE codes:
732
args_parser.parse(argc, argv);
if (preserve) {
umask(0);
} else {
if (pledge("stdio rpath wpath cpath fattr", nullptr) < 0) {
perror("pledge");
return 1;
}
Reported by FlawFinder.
Userland/Utilities/cpp-parser.cpp
1 issues
Line: 23
Column: 16
CWE codes:
362
if (!path)
path = "Source/little/main.cpp";
auto file = Core::File::construct(path);
if (!file->open(Core::OpenMode::ReadOnly)) {
perror("open");
exit(1);
}
auto content = file->read_all();
StringView content_view(content);
Reported by FlawFinder.
Userland/Utilities/cpp-preprocessor.cpp
1 issues
Line: 21
Column: 16
CWE codes:
362
args_parser.add_option(print_definitions, "Print preprocessor definitions", "definitions", 'D');
args_parser.parse(argc, argv);
auto file = Core::File::construct(path);
if (!file->open(Core::OpenMode::ReadOnly)) {
perror("open");
exit(1);
}
auto content = file->read_all();
String name = LexicalPath::basename(path);
Reported by FlawFinder.
Userland/Utilities/top.cpp
1 issues
Line: 211
Column: 5
CWE codes:
676
Suggestion:
Use nanosleep(2) or setitimer(2) instead
Vector<ThreadData*> threads;
auto prev = get_snapshot();
usleep(10000);
for (;;) {
if (g_window_size_changed) {
int rc = ioctl(STDOUT_FILENO, TIOCGWINSZ, &g_window_size);
if (rc < 0) {
perror("ioctl(TIOCGWINSZ)");
Reported by FlawFinder.
Userland/Utilities/cut.cpp
1 issues
Line: 149
Column: 14
CWE codes:
362
{
FILE* fp = stdin;
if (!file.is_null()) {
fp = fopen(file.characters(), "r");
if (!fp) {
warnln("cut: Could not open file '{}'", file);
return;
}
}
Reported by FlawFinder.
Userland/Utilities/touch.cpp
1 issues
Line: 51
Column: 22
CWE codes:
362
if (rc < 0)
perror("utime");
} else {
int fd = open(path, O_CREAT, 0100644);
if (fd < 0) {
perror("open");
return 1;
}
int rc = close(fd);
Reported by FlawFinder.
Userland/Applications/SystemMonitor/NetworkStatisticsWidget.h
1 issues
Line: 13
#include <LibGUI/LazyWidget.h>
class NetworkStatisticsWidget final : public GUI::LazyWidget {
C_OBJECT(NetworkStatisticsWidget)
public:
virtual ~NetworkStatisticsWidget() override;
private:
NetworkStatisticsWidget();
Reported by Cppcheck.
Userland/Utilities/df.cpp
1 issues
Line: 38
Column: 16
CWE codes:
362
args_parser.parse(argc, argv);
auto file = Core::File::construct("/proc/df");
if (!file->open(Core::OpenMode::ReadOnly)) {
warnln("Failed to open {}: {}", file->name(), file->error_string());
return 1;
}
if (flag_human_readable) {
Reported by FlawFinder.
Userland/Applications/SystemMonitor/ThreadStackWidget.h
1 issues
Line: 13
#include <LibGUI/Widget.h>
class ThreadStackWidget final : public GUI::Widget {
C_OBJECT(ThreadStackWidget)
public:
virtual ~ThreadStackWidget() override;
void set_ids(pid_t pid, pid_t tid);
void refresh();
Reported by Cppcheck.