From: Thomas Roessler Date: Mon, 3 Sep 2001 12:17:33 +0000 (+0000) Subject: Don't try to attach non-regular files. #754. X-Git-Tag: mutt-1-3-23-rel~30 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=178af9bda876303bf301dd3883cb84d9ed364e93;p=mutt Don't try to attach non-regular files. #754. --- diff --git a/sendlib.c b/sendlib.c index 022fbd25..faa7f164 100644 --- a/sendlib.c +++ b/sendlib.c @@ -891,7 +891,21 @@ CONTENT *mutt_get_content_info (const char *fname, BODY *b) char chsbuf[STRING]; size_t r; + struct stat sb; + if(b && !fname) fname = b->filename; + + if (stat (fname, &sb) == -1) + { + mutt_error (_("Can't stat %s."), fname); + return NULL; + } + + if (!S_ISREG(sb.st_mode)) + { + mutt_error (_("%s isn't a regular file."), fname); + return NULL; + } if ((fp = fopen (fname, "r")) == NULL) { @@ -1375,7 +1389,10 @@ BODY *mutt_make_file_attach (const char *path) #endif if ((info = mutt_get_content_info (path, att)) == NULL) + { + mutt_free_body (&att); return NULL; + } if (!att->subtype) {