Przeglądaj źródła

* Ported [2706] to 1.2.9 (startup segfault, fixes #195)

svn: 2707
Bryan Drewery 20 lat temu
rodzic
commit
88e63965f7
2 zmienionych plików z 7 dodań i 3 usunięć
  1. 1 0
      doc/UPDATES
  2. 6 3
      src/shell.c

+ 1 - 0
doc/UPDATES

@@ -56,6 +56,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Modified a kick to be less offensive (fixes #175)
 * Fixed bots not enforcing bans when exempts were removed. (fixes #193)
 * Updated CREDITS/cmd_about
+* Fixed some startup segfaults resulting from bugs in glibc.
 
 1.2.8
 * Fixed [bot]* cmds depending on case of botnicks.

+ 6 - 3
src/shell.c

@@ -811,12 +811,14 @@ char *homedir(bool useconf)
  
       ContextNote("getpwuid()");
       pw = getpwuid(myuid);
-      simple_snprintf(tmp, sizeof tmp, "%s", pw->pw_dir);
+      if (pw)
+        simple_snprintf(tmp, sizeof tmp, "%s", pw->pw_dir);
       ContextNote("getpwuid(): Success");
 #endif /* CYGWIN_HACKS */
     }
     ContextNote("realpath()");
-    realpath(tmp, homedir_buf); /* this will convert lame home dirs of /home/blah->/usr/home/blah */
+    if (tmp[0])
+      realpath(tmp, homedir_buf); /* this will convert lame home dirs of /home/blah->/usr/home/blah */
     ContextNote("realpath(): Success");
   }
   return homedir_buf;
@@ -835,7 +837,8 @@ char *my_username()
     ContextNote("getpwuid()");
     pw = getpwuid(myuid);
     ContextNote("getpwuid(): Success");
-    simple_snprintf(username, sizeof username, "%s", pw->pw_name);
+    if (pw)
+      simple_snprintf(username, sizeof username, "%s", pw->pw_name);
 #endif /* CYGWIN_HACKS */
   }
   return username;