[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdepim/kmail [POSSIBLY UNSAFE]
From:       Ingo Klöcker <ingo.kloecker () epost ! de>
Date:       2003-04-09 23:00:07
[Download RAW message or body]

CVS commit by kloecker: 

Fix bug 42646: multipart/digest forwarding is broken - uses empty boundary
For some reason fwdMsg->mMsg->Headers().ContentType().Boundary().c_str() returns a \
null string after the first call. Another non-obvious mimelib peculiarity. \
Furthermore the closing mime boundary was missing.


  M +7 -5      kmcommands.cpp   1.34 [POSSIBLY UNSAFE: printf]


--- kdepim/kmail/kmcommands.cpp  #1.33:1.34
@@ -669,7 +669,7 @@ void KMForwardCommand::execute()
       fwdMsg->setAutomaticFields(true);
       fwdMsg->mMsg->Headers().ContentType().CreateBoundary(1);
+      QCString boundary( fwdMsg->mMsg->Headers().ContentType().Boundary().c_str() );
       msgPartText = i18n("\nThis is a MIME digest forward. The content of the"
-                         " message is contained in the attachment(s).\n\n\n"
-                         "--\n");
+                         " message is contained in the attachment(s).\n\n\n");
       // iterate through all the messages to be forwarded
       for (KMMessage *msg = msgList.first(); msg; msg = msgList.next()) {
@@ -679,5 +679,5 @@ void KMForwardCommand::execute()
         // set the part header
         msgPartText += "--";
-        msgPartText += fwdMsg->mMsg->Headers().ContentType().Boundary().c_str();
+        msgPartText += QString::fromLatin1( boundary );
         msgPartText += "\nContent-Type: MESSAGE/RFC822";
         msgPartText += QString("; CHARSET=%1").arg(msg->charset());
@@ -698,8 +698,10 @@ void KMForwardCommand::execute()
         fwdMsg->link(msg, KMMsgStatusForwarded);
       }
+      msgPartText += "--";
+      msgPartText += QString::fromLatin1( boundary );
+      msgPartText += "--\n";
       QCString tmp;
       msgPart->setTypeStr("MULTIPART");
-      tmp.sprintf( "Digest; boundary=\"%s\"",
-                   fwdMsg->mMsg->Headers().ContentType().Boundary().c_str() );
+      tmp.sprintf( "Digest; boundary=\"%s\"", boundary.data() );
       msgPart->setSubtypeStr( tmp );
       msgPart->setName("unnamed");


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic