]> granicus.if.org Git - neomutt/commitdiff
Don't try to attach non-regular files. #754.
authorThomas Roessler <roessler@does-not-exist.org>
Mon, 3 Sep 2001 12:17:33 +0000 (12:17 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Mon, 3 Sep 2001 12:17:33 +0000 (12:17 +0000)
sendlib.c

index 022fbd25ecfc3224066bf2afdd852cc7942f5089..faa7f164a1f3378325fce34bd95a83a142939262 100644 (file)
--- 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)
   {