From fb19d1fe7b522a05366f513387fef4456c336de8 Mon Sep 17 00:00:00 2001 From: David Levine Date: Fri, 24 Jan 2014 21:10:03 -0600 Subject: [PATCH] Removed 3 renames of temporary files in mhparse.c. They added unnecessary filename extensions to the temp files. They weren't good from a security standpoint and added a failure mode. --- uip/mhparse.c | 36 +++--------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) diff --git a/uip/mhparse.c b/uip/mhparse.c index 9489a8e4..58f3a81c 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -1669,17 +1669,7 @@ openBase64 (CT ct, char **file) cp = context_find (buffer); } if (cp != NULL && *cp != '\0') { - if (ce->ce_unlink) { - /* Temporary file already exists, so we rename to - version with extension. */ - char *file_org = strdup(ce->ce_file); - ce->ce_file = add (cp, ce->ce_file); - if (rename(file_org, ce->ce_file)) { - adios (ce->ce_file, "unable to rename %s to ", file_org); - } - free(file_org); - - } else { + if (! ce->ce_unlink) { ce->ce_file = add (cp, ce->ce_file); } } @@ -1908,17 +1898,7 @@ openQuoted (CT ct, char **file) cp = context_find (buffer); } if (cp != NULL && *cp != '\0') { - if (ce->ce_unlink) { - /* Temporary file already exists, so we rename to - version with extension. */ - char *file_org = strdup(ce->ce_file); - ce->ce_file = add (cp, ce->ce_file); - if (rename(file_org, ce->ce_file)) { - adios (ce->ce_file, "unable to rename %s to ", file_org); - } - free(file_org); - - } else { + if (! ce->ce_unlink) { ce->ce_file = add (cp, ce->ce_file); } } @@ -2137,17 +2117,7 @@ open7Bit (CT ct, char **file) cp = context_find (buffer); } if (cp != NULL && *cp != '\0') { - if (ce->ce_unlink) { - /* Temporary file already exists, so we rename to - version with extension. */ - char *file_org = strdup(ce->ce_file); - ce->ce_file = add (cp, ce->ce_file); - if (rename(file_org, ce->ce_file)) { - adios (ce->ce_file, "unable to rename %s to ", file_org); - } - free(file_org); - - } else { + if (! ce->ce_unlink) { ce->ce_file = add (cp, ce->ce_file); } } -- 2.56.0