From: Tony Finch Date: Thu, 6 Dec 2012 19:11:28 +0000 (+0000) Subject: Correct gecos expansion when From: is a prefix of the username. X-Git-Tag: exim-4_81_RC1~3^2~27 X-Git-Url: https://git.exim.org/users/heiko/exim.git/commitdiff_plain/326cdc37059420d73ba121daaf74def9b53b9e3b Correct gecos expansion when From: is a prefix of the username. Test 0254 submits a message to Exim with the header Resent-From: f When I ran the test suite under the user fanf2, Exim expanded the header to contain my full name, whereas it should have added a Resent-Sender: header. It erroneously treats any prefix of the username as equal to the username. This change corrects that bug. --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 577ac39f0..b516a7118 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -120,6 +120,19 @@ TF/01 Fix ultimate retry timeouts for intermittently deliverable recipients. I suspect this new check makes the old local delivery cutoff check redundant, but I have not verified this so I left the code in place. +TF/02 Correct gecos expansion when From: is a prefix of the username. + + Test 0254 submits a message to Exim with the header + + Resent-From: f + + When I ran the test suite under the user fanf2, Exim expanded + the header to contain my full name, whereas it should have added + a Resent-Sender: header. It erroneously treats any prefix of the + username as equal to the username. + + This change corrects that bug. + Exim version 4.80.1 ------------------- diff --git a/src/src/receive.c b/src/src/receive.c index 1943a74c7..4d77bcd96 100644 --- a/src/src/receive.c +++ b/src/src/receive.c @@ -2037,7 +2037,7 @@ for (h = header_list->next; h != NULL; h = h->next) { uschar *s = Ustrchr(h->text, ':') + 1; while (isspace(*s)) s++; - if (strncmpic(s, originator_login, h->slen - (s - h->text) - 1) == 0) + if (strcmpic(s, originator_login) == 0) { uschar *name = is_resent? US"Resent-From" : US"From"; header_add(htype_from, "%s: %s <%s@%s>\n", name, originator_name,