mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
r14869@catbus: nickm | 2007-08-31 08:49:26 -0400
Fix a segfault in expand_filename("~"). Found by lindi. svn:r11332
This commit is contained in:
parent
04fcaf5f06
commit
c341bc090e
@ -19,6 +19,8 @@ Changes in version 0.2.0.7-alpha - 2007-??-??
|
||||
bug 467.
|
||||
- On OSX, stop warning the user that kqueue support in libevent is
|
||||
"experimental", since it seems to have worked fine for ages.
|
||||
- Fix a user-triggerable segfault in expand_filename(). (There isn't
|
||||
a way to trigger this remotely.)
|
||||
|
||||
o Code simplifications and refactoring:
|
||||
- Revamp file-writing logic so we don't need to have the entire contents
|
||||
|
@ -1839,7 +1839,7 @@ expand_filename(const char *filename)
|
||||
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;
|
||||
@ -1854,7 +1854,7 @@ expand_filename(const char *filename)
|
||||
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);
|
||||
@ -1869,7 +1869,7 @@ expand_filename(const char *filename)
|
||||
* 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"PATH_SEPARATOR"%s",home,rest?rest:"");
|
||||
tor_snprintf(result,len,"%s"PATH_SEPARATOR"%s",home,rest);
|
||||
tor_free(home);
|
||||
return result;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user