git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] copy_gecos: fix not adding nlen to len when processing "&"
@ 2011-05-16 20:08 Rafael Gieschke
  2011-05-18  4:28 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Rafael Gieschke @ 2011-05-16 20:08 UTC (permalink / raw)
  To: git, gitster


nlen has to be added to len when inserting (capitalized) pw_name as
substitution for "&" in pw_gecos. Otherwise, pw_gecos will be truncated and data
might be written beyond name+sz.

Signed-off-by: Rafael Gieschke <rafael@gieschke.de>
---
 ident.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/ident.c b/ident.c
index 1c4adb0..8e56b5e 100644
--- a/ident.c
+++ b/ident.c
@@ -34,6 +34,7 @@ static void copy_gecos(const struct passwd *w, char *name, size_t sz)
 			*dst++ = toupper(*w->pw_name);
 			memcpy(dst, w->pw_name + 1, nlen - 1);
 			dst += nlen - 1;
+			len += nlen;
 		}
 	}
 	if (len < sz)
-- 
1.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] copy_gecos: fix not adding nlen to len when processing "&"
  2011-05-16 20:08 [PATCH] copy_gecos: fix not adding nlen to len when processing "&" Rafael Gieschke
@ 2011-05-18  4:28 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2011-05-18  4:28 UTC (permalink / raw)
  To: Rafael Gieschke; +Cc: git

Thanks, will queue.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-18  4:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-16 20:08 [PATCH] copy_gecos: fix not adding nlen to len when processing "&" Rafael Gieschke
2011-05-18  4:28 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).