[or-cvs] r11608: Backport r11332: fix a user-triggerable segfault in expand_f (in tor/branches/tor-0_1_2-patches: . doc src/common)

nickm at seul.org nickm at seul.org
Mon Sep 24 15:53:51 UTC 2007


Author: nickm
Date: 2007-09-24 11:53:51 -0400 (Mon, 24 Sep 2007)
New Revision: 11608

Modified:
   tor/branches/tor-0_1_2-patches/
   tor/branches/tor-0_1_2-patches/ChangeLog
   tor/branches/tor-0_1_2-patches/doc/TODO.012
   tor/branches/tor-0_1_2-patches/src/common/util.c
Log:
 r15320 at catbus:  nickm | 2007-09-24 11:49:09 -0400
 Backport r11332: fix a user-triggerable segfault in expand_filename("~").



Property changes on: tor/branches/tor-0_1_2-patches
___________________________________________________________________
 svk:merge ticket from /tor/012 [r15320] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/branches/tor-0_1_2-patches/ChangeLog
===================================================================
--- tor/branches/tor-0_1_2-patches/ChangeLog	2007-09-24 15:53:49 UTC (rev 11607)
+++ tor/branches/tor-0_1_2-patches/ChangeLog	2007-09-24 15:53:51 UTC (rev 11608)
@@ -10,6 +10,8 @@
     - When generating information telling us how to extend to a given
       router, do not try to include the nickname if it is absent. (Resolves
       bug 467.)
+    - Fix a user-triggerable segfault in expand_filename().  (There isn't
+      a way to trigger this remotely.)
 
   o Minor bugfixes (controller):
     - When sending a status event to the controller telling it that an

Modified: tor/branches/tor-0_1_2-patches/doc/TODO.012
===================================================================
--- tor/branches/tor-0_1_2-patches/doc/TODO.012	2007-09-24 15:53:49 UTC (rev 11607)
+++ tor/branches/tor-0_1_2-patches/doc/TODO.012	2007-09-24 15:53:51 UTC (rev 11608)
@@ -25,4 +25,4 @@
   - r11499, r11500, r11501: hidserv hexdigests rather than nicknames
   - r11548, the osx /tmp fix
   o r11293: Bulletproof code to generate extend info.
-  - r11332: Fix user-triggerable segfault in expand_filename("~")
\ No newline at end of file
+  o r11332: Fix user-triggerable segfault in expand_filename("~")
\ No newline at end of file

Modified: tor/branches/tor-0_1_2-patches/src/common/util.c
===================================================================
--- tor/branches/tor-0_1_2-patches/src/common/util.c	2007-09-24 15:53:49 UTC (rev 11607)
+++ tor/branches/tor-0_1_2-patches/src/common/util.c	2007-09-24 15:53:51 UTC (rev 11608)
@@ -1555,7 +1555,7 @@
         return NULL;
       }
       home = tor_strdup(home);
-      rest = strlen(filename)>=2?(filename+2):NULL;
+      rest = strlen(filename)>=2?(filename+2):"";
     } else {
 #ifdef HAVE_PWD_H
       char *username, *slash;
@@ -1570,7 +1570,7 @@
         return NULL;
       }
       tor_free(username);
-      rest = slash ? (slash+1) : NULL;
+      rest = slash ? (slash+1) : "";
 #else
       log_warn(LD_CONFIG, "Couldn't expend homedir on system without pwd.h");
       return tor_strdup(filename);
@@ -1585,7 +1585,7 @@
      * Round up to 16 in case we can't do math. */
     len = strlen(home)+strlen(rest)+16;
     result = tor_malloc(len);
-    tor_snprintf(result,len,"%s/%s",home,rest?rest:"");
+    tor_snprintf(result,len,"%s/%s",home,rest);
     tor_free(home);
     return result;
   } else {



More information about the tor-commits mailing list