File: 13-fix-order-of-tests-to-avoid-strstr-on-NULL-value.patch

package info (click to toggle)
shadowsocks-libev 3.3.5%2Bds-16
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 3,496 kB
  • sloc: ansic: 14,124; sh: 1,338; makefile: 197; python: 111
file content (23 lines) | stat: -rw-r--r-- 934 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
From: Gilles Depeyrot <g.depeyrot@transacom.fr>
Date: Thu, 15 Jul 2021 14:43:22 +0200
Subject: fix order of tests to avoid strstr on NULL value
Forwarded: not-needed

(cherry picked from commit abcf85e98300762e4f31953cecf635ab182ef859)
---
 src/manager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/manager.c b/src/manager.c
index 64f4d24..8a229d0 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -1123,7 +1123,7 @@ main(int argc, char **argv)
     if (workdir == NULL || strlen(workdir) == 0) {
         workdir = pw->pw_dir;
         // If home dir is still not defined or set to nologin/nonexistent, fall back to /tmp
-        if (strstr(workdir, "nologin") || strstr(workdir, "nonexistent") || workdir == NULL || strlen(workdir) == 0) {
+        if (workdir == NULL || strlen(workdir) == 0 || strstr(workdir, "nologin") || strstr(workdir, "nonexistent")) {
             workdir = "/tmp";
         }