]> git.cameronkatri.com Git - cgit.git/commitdiff
parsing: ban sprintf()
authorChristian Hesse <mail@eworm.de>
Tue, 28 Aug 2018 16:14:32 +0000 (18:14 +0200)
committerChristian Hesse <mail@eworm.de>
Tue, 11 Sep 2018 06:47:12 +0000 (08:47 +0200)
Git upstream bans sprintf() with commit:

  banned.h: mark sprintf() as banned
  cc8fdaee1eeaf05d8dd55ff11f111b815f673c58

Signed-off-by: Christian Hesse <mail@eworm.de>
parsing.c

index e224564dc5346e74300ca35b567a6799f701ca57..9e73e70c3cf909125f7444c7d7f96ea6c87466eb 100644 (file)
--- a/parsing.c
+++ b/parsing.c
@@ -77,7 +77,7 @@ static void parse_user(const char *t, char **name, char **email, unsigned long *
 
                email_len = ident.mail_end - ident.mail_begin;
                *email = xmalloc(strlen("<") + email_len + strlen(">") + 1);
-               sprintf(*email, "<%.*s>", email_len, ident.mail_begin);
+               xsnprintf(*email, email_len + 3, "<%.*s>", email_len, ident.mail_begin);
 
                if (ident.date_begin)
                        *date = strtoul(ident.date_begin, NULL, 10);