daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
3d3dc8
From af6eac25456d4ca7e8233e00aec7531e640f17af Mon Sep 17 00:00:00 2001
3d3dc8
From: Lennart Poettering <lennart@poettering.net>
3d3dc8
Date: Fri, 5 Apr 2019 15:31:34 +0200
3d3dc8
Subject: [PATCH] lgtm: warn about strerror() use
3d3dc8
3d3dc8
(cherry picked from commit 9ff46eded2b99d244455467eb55c0ff3f51c5362)
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 cd0284b37a..96712cf1c6 100644
3d3dc8
--- a/.lgtm/cpp-queries/PotentiallyDangerousFunction.ql
3d3dc8
+++ b/.lgtm/cpp-queries/PotentiallyDangerousFunction.ql
3d3dc8
@@ -38,6 +38,9 @@ predicate potentiallyDangerousFunction(Function f, string message) {
3d3dc8
   ) or (
3d3dc8
     f.getQualifiedName() = "ntohs" and
3d3dc8
     message = "Call to ntohs() is confusing. Use be16toh() instead."
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
   )
3d3dc8
 }
3d3dc8