From: Ken Hornstein Date: Tue, 25 Jul 2017 19:40:28 +0000 (-0400) Subject: Finished implementation, but tests need to be written. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/e4434832c4720bcab50b5c10b2c880a2fef905c8?hp=-c Finished implementation, but tests need to be written. --- e4434832c4720bcab50b5c10b2c880a2fef905c8 diff --git a/uip/post.c b/uip/post.c index 02e3283a..9282a71c 100644 --- a/uip/post.c +++ b/uip/post.c @@ -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'; - savehdlen = sizeof(fullfrom); + savehdrlen = sizeof(fullfrom); } tmpaddrs.m_next = NULL; @@ -1068,13 +1068,12 @@ putfmt (char *name, char *str, int *eai, FILE *out) 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'; } @@ -1298,7 +1297,7 @@ putadr (char *name, char *aka, struct mailname *mp, FILE *out, fputs (cp, out); if (saveappend && shlen + len < savehdrsize) - strncat(savehdr, out); + strncat(savehdr, cp, savehdrsize - shlen + len); linepos += len;