dryang / rpms / systemd

Forked from rpms/systemd a year ago
Clone
3d3dc8
From bfa090ce83f2b0734c526a4426a20f6f0f943aa0 Mon Sep 17 00:00:00 2001
3d3dc8
From: Lennart Poettering <lennart@poettering.net>
3d3dc8
Date: Wed, 10 Apr 2019 19:36:40 +0200
3d3dc8
Subject: [PATCH] lgtm: complain about accept() [people should use accept4()
3d3dc8
 instead, due to O_CLOEXEC]
3d3dc8
3d3dc8
(cherry picked from commit e2d0fa6feb3797246c8bfda3db45a2f5b62e1b5b)
3d3dc8
3d3dc8
Related: #2017033
3d3dc8
---
3d3dc8
 .lgtm/cpp-queries/PotentiallyDangerousFunction.ql | 3 +++
3d3dc8
 1 file changed, 3 insertions(+)
3d3dc8
3d3dc8
diff --git a/.lgtm/cpp-queries/PotentiallyDangerousFunction.ql b/.lgtm/cpp-queries/PotentiallyDangerousFunction.ql
3d3dc8
index 96712cf1c6..865330430d 100644
3d3dc8
--- a/.lgtm/cpp-queries/PotentiallyDangerousFunction.ql
3d3dc8
+++ b/.lgtm/cpp-queries/PotentiallyDangerousFunction.ql
3d3dc8
@@ -41,6 +41,9 @@ predicate potentiallyDangerousFunction(Function f, string message) {
3d3dc8
   ) or (
3d3dc8
     f.getQualifiedName() = "strerror" and
3d3dc8
     message = "Call to strerror() is not thread-safe. Use strerror_r() or printf()'s %m format string instead."
3d3dc8
+  ) or (
3d3dc8
+    f.getQualifiedName() = "accept" and
3d3dc8
+    message = "Call to accept() is not O_CLOEXEC-safe. Use accept4() instead."
3d3dc8
   )
3d3dc8
 }
3d3dc8