X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/a109ec7024b3c857ab1b628788ec6c15c19ca513..af56ad38ce8b8123cf048bd02fabec21ba580d15:/uip/post.c 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;