- Miscellaneous comment fixes. (DLR)
- files.c:
do_insertfile()
- - Properly handle files and executable commands that contain
+ - Properly handle filenames and executable commands that contain
nulls. (DLR)
+ write_file()
+ - Properly handle filenames that contain nulls. (DLR)
- nano.h:
- Rename NANO_ALT_REPLACE_KEY to NANO_REPLACE_ALTKEY, for
consistency. (DLR)
int retval = -1;
/* Instead of returning in this function, you should always
* merely set retval and then goto cleanup_and_exit. */
- size_t lineswritten = 0;
+ size_t name_len, lineswritten = 0;
const filestruct *fileptr = openfile->fileage;
int fd;
/* The file descriptor we use. */
if (!tmp)
titlebar(NULL);
+ name_len = strlen(name);
+
+ /* Convert newlines to nulls, just before we get the real
+ * filename. */
+ sunder(name);
+
realname = real_dir_from_tilde(name);
+ /* Convert nulls to newlines. name_len is the string's real
+ * length. */
+ unsunder(name, name_len);
+
#ifndef DISABLE_OPERATINGDIR
/* If we're writing a temporary file, we're probably going outside
* the operating directory, so skip the operating directory test. */