File: fix-bug-with-rootdir-as-home.patch

package info (click to toggle)
dirb 2.22%2Bdfsg-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,244 kB
  • sloc: ansic: 1,704; sh: 1,132; makefile: 51; perl: 23
file content (28 lines) | stat: -rw-r--r-- 977 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Description: Avoid infinite recursion when HOME=/
 We do this by ensuring that HOME=/root when HOME=/.
Author: Raphaƫl Hertzog <buxy@kali.org>
Forwarded: not-needed
Bug-Kali: https://bugs.kali.org/view.php?id=2387

diff --git a/src/resume.c b/src/resume.c
index 553d461..b52df43 100644
--- a/src/resume.c
+++ b/src/resume.c
@@ -35,6 +35,8 @@ void dump(void) {
   // Comprobamos si existe el directorio y sino intentamos crealo
 
   home = getenv("HOME");
+  if (strcmp(home, "/") == 0)
+    home = "/root";
   asprintf(&dumppath,"%s/%s", home, DUMP_DIR);
   asprintf(&optionspath, "%s/%s", home, OPTIONS_DUMP);
   asprintf(&wordlistpath, "%s/%s", home, WORDLIST_DUMP);
@@ -106,6 +108,8 @@ void resume(void) {
 
   resuming=1;
   home = getenv("HOME");
+  if (strcmp(home, "/") == 0)
+    home = "/root";
   asprintf(&dumppath,"%s/%s",home,DUMP_DIR);
   asprintf(&optionspath, "%s/%s",home,OPTIONS_DUMP);
   asprintf(&wordlistpath, "%s/%s",home,WORDLIST_DUMP);