]> diplodocus.org Git - nmh/commitdiff
Finished implementation, but tests need to be written.
authorKen Hornstein <kenh@pobox.com>
Tue, 25 Jul 2017 19:40:28 +0000 (15:40 -0400)
committerKen Hornstein <kenh@pobox.com>
Tue, 25 Jul 2017 19:40:28 +0000 (15:40 -0400)
uip/post.c

index 02e3283..9282a71 100644 (file)
@@ -886,7 +886,7 @@ putfmt (char *name, char *str, int *eai, FILE *out)
     if ((msgstate == RESENT) ? (hdr->set & MRFM) : (hdr->set & MFRM)) {
        savehdr = fullfrom;
        savehdr[0] = '\0';
     if ((msgstate == RESENT) ? (hdr->set & MRFM) : (hdr->set & MFRM)) {
        savehdr = fullfrom;
        savehdr[0] = '\0';
-       savehdlen = sizeof(fullfrom);
+       savehdrlen = sizeof(fullfrom);
     }
 
     tmpaddrs.m_next = NULL;
     }
 
     tmpaddrs.m_next = NULL;
@@ -1068,13 +1068,12 @@ putfmt (char *name, char *str, int *eai, FILE *out)
                mnfree (mp);
        }
 
                mnfree (mp);
        }
 
-#error
-       strncpy(fullfrom, str, sizeof(fullfrom));
-       fullfrom[sizeof(fullfrom) - 1] = 0;
-       /*
-        * Strip off any trailing newlines
-        */
+    /*
+     * If it was a From header, strip off any trailing newlines from
+     * the alias-expanded From line.
+     */
 
 
+    if ((msgstate == RESENT) ? (hdr->set & MRFM) : (hdr->set & MFRM)) {
        while (*fullfrom && fullfrom[strlen(fullfrom) - 1] == '\n') {
            fullfrom[strlen(fullfrom) - 1] = '\0';
        }
        while (*fullfrom && fullfrom[strlen(fullfrom) - 1] == '\n') {
            fullfrom[strlen(fullfrom) - 1] = '\0';
        }
@@ -1298,7 +1297,7 @@ putadr (char *name, char *aka, struct mailname *mp, FILE *out,
     fputs (cp, out);
 
     if (saveappend && shlen + len < savehdrsize)
     fputs (cp, out);
 
     if (saveappend && shlen + len < savehdrsize)
-       strncat(savehdr, out);
+       strncat(savehdr, cp, savehdrsize - shlen + len);
 
     linepos += len;
 
 
     linepos += len;