)]}'
{
  "commit": "c375a7efa3a42afc51385659437f04027ed106b1",
  "tree": "468d44656a0f9a68e1ad431e1e3dacef45bd80ea",
  "parents": [
    "0b65a8dbdb38962e700ee16776a3042beb489060"
  ],
  "author": {
    "name": "Jeff King",
    "email": "peff@peff.net",
    "time": "Fri Sep 23 00:37:53 2016 -0400"
  },
  "committer": {
    "name": "Junio C Hamano",
    "email": "gitster@pobox.com",
    "time": "Fri Sep 23 10:01:15 2016 -0700"
  },
  "message": "ident: handle NULL ai_canonname\n\nWe call getaddrinfo() to try to convert a short hostname\ninto a fully-qualified one (to use it as an email domain).\nIf there isn\u0027t a canonical name, getaddrinfo() will\ngenerally return either a NULL addrinfo list, or one in\nwhich ai-\u003eai_canonname is a copy of the original name.\n\nHowever, if the result of gethostname() looks like an IP\naddress, then getaddrinfo() behaves differently on some\nsystems. On OS X, it will return a \"struct addrinfo\" with a\nNULL ai_canonname, and we segfault feeding it to strchr().\n\nThis is hard to test reliably because it involves not only a\nsystem where we we have to fallback to gethostname() to come\nup with an ident, but also where the hostname is a number\nwith no dots. But I was able to replicate the bug by faking\na hostname, like:\n\n    diff --git a/ident.c b/ident.c\n    index e20a772..b790d28 100644\n    --- a/ident.c\n    +++ b/ident.c\n    @@ -128,6 +128,7 @@ static void add_domainname(struct strbuf *out, int *is_bogus)\n                     *is_bogus \u003d 1;\n                     return;\n             }\n    +        xsnprintf(buf, sizeof(buf), \"1\");\n             if (strchr(buf, \u0027.\u0027))\n                     strbuf_addstr(out, buf);\n             else if (canonical_name(buf, out) \u003c 0) {\n\nand running \"git var GIT_AUTHOR_IDENT\" on an OS X system.\n\nBefore this patch it segfaults, and after we correctly\ncomplain of the bogus \"user@1.(none)\" address (though this\nbogus address would be suitable for non-object uses like\nwriting reflogs).\n\nReported-by: Jonas Thiel \u003cjonas.lierschied@gmx.de\u003e\nDiagnosed-by: John Keeping \u003cjohn@keeping.me.uk\u003e\nSigned-off-by: Jeff King \u003cpeff@peff.net\u003e\nSigned-off-by: Junio C Hamano \u003cgitster@pobox.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "4fd82d104365c2e2c1ab7e1597e7e246c8eded24",
      "old_mode": 33188,
      "old_path": "ident.c",
      "new_id": "28bc85491872704162c33fa7ac09460bc5b35a11",
      "new_mode": 33188,
      "new_path": "ident.c"
    }
  ]
}
