From: NRK Date: Sun, 5 Mar 2023 12:43:08 +0000 (+0600) Subject: add some critical comments X-Git-Tag: v4.8~5^2 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=003228afbae1586c3765824bcfe102f621be9fa8;p=nnn.git add some critical comments --- diff --git a/src/nnn.c b/src/nnn.c index 75ab5a06..491749ab 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -1147,6 +1147,7 @@ static size_t mkpath(const char *dir, const char *name, char *out) { size_t len = 0; + /* same rational for being strict as abspath() */ if (tilde_is_home_strict(name)) { //NOLINT len = xstrsncpy(out, home, PATH_MAX); --len; @@ -1215,6 +1216,9 @@ static char *abspath(const char *filepath, char *cwd, char *buf) if (!path) return NULL; + /* when dealing with tilde, we need to be strict. + * otherwise a file named "~" can end up expanding to + * $HOME and causing disaster */ if (tilde_is_home_strict(path)) { cwd = home; path += 2; /* advance 2 bytes past the "~/" */