]> code.citadel.org Git - citadel.git/blobdiff - citadel/internet_addressing.c
* migrate redirect_buffer logic to StrBuf, valgrind reported some related errors.
[citadel.git] / citadel / internet_addressing.c
index 14439a6abce4d3b8fa8a922c6b216406492a4a1a..006ad8e9b401a64a25eda40a4bd8d87dc33565f9 100644 (file)
@@ -574,7 +574,7 @@ int convert_field(struct CtdlMessage *msg, const char *beg, const char *end) {
        * ( key + (colonpos - beg) ) = '\0';
        value = &key[(colonpos - beg) + 1];
        unfold_rfc822_field(&value, &valueend);
-       valuelen = valueend - value;
+       valuelen = valueend - value + 1;
 
        /*
         * Here's the big rfc822-to-citadel loop.
@@ -798,6 +798,7 @@ struct CtdlMessage *convert_internet_message_buf(StrBuf **rfc822)
                /* Strip the field out of the RFC822 header if we used it */
                if (!converted) {
                        StrBufAppendBufPlain(OtherHeaders, beg, end - beg, 0);
+                       StrBufAppendBufPlain(OtherHeaders, HKEY("\n"), 0);
                }
 
                /* If we've hit the end of the message, bail out */
@@ -837,7 +838,7 @@ struct CtdlMessage *convert_internet_message_buf(StrBuf **rfc822)
  * The caller is responsible for freeing the returned buffer.  If the requested
  * field is not present, or anything else goes wrong, it returns NULL.
  */
-char *rfc822_fetch_field(char *rfc822, const char *fieldname) {
+char *rfc822_fetch_field(const char *rfc822, const char *fieldname) {
        char *fieldbuf = NULL;
        const char *end_of_headers;
        const char *field_start;