commit 0b0b8122067d57af9819fc807e0b21e5687113a9
parent eafae5d417cb9cfdb1586cc9db1e7cca69e5f60f
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Sun, 18 Dec 2016 11:37:57 +0100
files: don't change embedded newlines into nulls in filenames
Because changing anything to a null effectively means to truncate
the name.
This fixes https://savannah.gnu.org/bugs/?49868
and fixes https://savannah.gnu.org/bugs/?49874.
Diffstat:
2 files changed, 0 insertions(+), 18 deletions(-)
diff --git a/src/browser.c b/src/browser.c
@@ -237,9 +237,6 @@ char *do_browser(char *path)
continue;
}
- /* Convert newlines to nulls in the directory name. */
- sunder(answer);
-
path = free_and_assign(path, real_dir_from_tilde(answer));
/* If the given path is relative, join it with the current path. */
diff --git a/src/files.c b/src/files.c
@@ -1173,9 +1173,6 @@ void do_insertfile(void)
current_was_at_top = (openfile->edittop == openfile->fileage);
}
- /* Convert newlines to nulls in the given filename. */
- sunder(answer);
-
#ifndef NANO_TINY
if (execute) {
#ifndef DISABLE_MULTIBUFFER
@@ -2320,15 +2317,10 @@ int do_writeout(bool exiting)
#endif
if (method == OVERWRITE) {
- size_t answer_len = strlen(answer);
bool name_exists, do_warning;
char *full_answer, *full_filename;
struct stat st;
- /* Convert newlines to nulls, just before we get the
- * full path. */
- sunder(answer);
-
full_answer = get_full_path(answer);
full_filename = get_full_path(openfile->filename);
name_exists = (stat((full_answer == NULL) ?
@@ -2340,10 +2332,6 @@ int do_writeout(bool exiting)
answer : full_answer, (full_filename == NULL) ?
openfile->filename : full_filename) != 0);
- /* Convert nulls to newlines. answer_len is the
- * string's real length. */
- unsunder(answer, answer_len);
-
free(full_filename);
free(full_answer);
@@ -2399,9 +2387,6 @@ int do_writeout(bool exiting)
#endif
}
- /* Convert newlines to nulls, just before we save the file. */
- sunder(answer);
-
/* Here's where we allow the selected text to be written to
* a separate file. If we're using restricted mode, this
* function is disabled, since it allows reading from or