[PATCH 1/1] enable cgit to show gravatar for author, committer and tagger

Christian Hesse mail at eworm.de
Thu Jan 9 10:13:55 CET 2014


"Jason A. Donenfeld" <Jason at zx2c4.com> on Wed, 2014/01/08 17:00:
> Sorry for the extended nitpicks....
> 
> On Wed, Jan 8, 2014 at 4:23 PM, Christian Hesse <mail at eworm.de> wrote:
> > +char *cgit_get_gravatar(const char *email)
> > +{
> > +
> > +       /* duplicate to lower and skip brackets! */
> > +       lower = strdup(email + 1);
> > +       lower[strlen(lower) - 1] = '\0';
> 
> Can email ever be passed in with no length at all? Or without
> brackets? It's not immediately clear to me from looking briefly at
> parse_user in parsing.c.

A really good question. Let's think about parse_user()... If t does not
include brackets the string ends up in name. If it does include brackets the
address ends up in email, including the brackets. So does (mode == 2 && *p ==
'\n') ever get true? Probably we have a piece of dead code.

I think email always includes brackets or is NULL. In later case
cgit_get_gravatar() is not executed, so everything should be fine.
-- 
Schoene Gruesse
Chris
                         O< ascii ribbon campaign
                   stop html mail - www.asciiribbon.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20140109/8fbd411d/attachment.asc>


More information about the CGit mailing list