names that begin with "~", but that aren't users' home directories
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4072
35c25a1d-7b9e-4130-9fde-
d3aeb78583b8
+2007-04-16 David Lawrence Ramsey <pooka109@gmail.com>
+
+ * files.c (get_real_dir_from_tilde): Fix segfault when dealing
+ with directory names that begin with "~", but that aren't users'
+ home directories. (DLR, found by Justin Fletcher)
+
2007-04-11 Mike Frysinger <vapier@gentoo.org>
* doc/syntax/asm.nanorc, doc/syntax/c.nanorc,
if (buf[0] == '~') {
size_t i;
- const char *tilde_dir;
+ const char *tilde_dir = NULL;
/* Figure out how much of the str we need to compare. */
for (i = 1; buf[i] != '/' && buf[i] != '\0'; i++)
} while (userdata != NULL &&
strncmp(userdata->pw_name, buf + 1, i - 1) != 0);
endpwent();
- tilde_dir = userdata->pw_dir;
+ if (userdata != NULL)
+ tilde_dir = userdata->pw_dir;
}
if (tilde_dir != NULL) {