)]}'
{
  "commit": "d6c0e1e2ffbf7913ab69d51cc794d48d41c8fcb1",
  "tree": "557d3818ec91ef4e281b49fd43f208a7e8383ac7",
  "parents": [
    "c77265b4ea89359c164346e400914bb24a3716d1"
  ],
  "author": {
    "name": "Herbert Xu",
    "email": "herbert@gondor.apana.org.au",
    "time": "Mon Oct 27 12:19:25 2014 +0800"
  },
  "committer": {
    "name": "Herbert Xu",
    "email": "herbert@gondor.apana.org.au",
    "time": "Mon Oct 27 12:19:25 2014 +0800"
  },
  "message": "[BUILTIN] Handle embedded NULs correctly in printf\n\nhttps://bugs.debian.org/cgi-bin/bugreport.cgi?bug\u003d379227\n\nOn Sat, Jul 22, 2006 at 12:48:38PM +0200, A Mennucc wrote:\n\u003e Package: dash\n\u003e Version: 0.5.3-3\n\u003e Severity: normal\n\u003e \n\u003e hi\n\u003e \n\u003e here are the examples\n\u003e \n\u003e $ bash -c \u0027echo -n -e \"A\\0102C\\00D\\0E\" | hexdump -c\u0027\n\u003e 0000000   A   B   C  \\0   D  \\0   E\n\u003e 0000007\n\u003e \n\u003e $ /bin/echo -n -e \"A\\0102C\\00D\\0E\" | hexdump -c\n\u003e 0000000   A   B   C  \\0   D  \\0   E\n\u003e 0000007\n\u003e \n\u003e $ zsh -c \u0027echo -n -e \"A\\0102C\\00D\\0E\" | hexdump -c\u0027\n\u003e 0000000   A   B   C  \\0   D  \\0   E\n\u003e 0000007\n\u003e \n\u003e $ dash -c \u0027echo -n  \"A\\0102C\\00D\\0E\" | hexdump -c\u0027\n\u003e 0000000   A   B   C\n\u003e 0000003\n\u003e \n\u003e and also\n\u003e \n\u003e $ dash -c \u0027echo -n  \"ABC\\0DEFGH\" | hexdump -c\u0027\n\u003e 0000000   A   B   C\n\u003e 0000003\n\u003e \n\u003e As you see, dash \u0027s builtin echo truncates the output at the first \\0\n\u003e \n\u003e a.\n\u003e \n\u003e -- System Information:\n\u003e Debian Release: testing/unstable\n\u003e   APT prefers unstable\n\u003e   APT policy: (500, \u0027unstable\u0027), (500, \u0027testing\u0027)\n\u003e Architecture: i386 (i686)\n\u003e Shell:  /bin/sh linked to /bin/bash\n\u003e Kernel: Linux 2.6.16-1-k7\n\u003e Locale: LANG\u003dit_IT.UTF-8, LC_CTYPE\u003dit_IT.UTF-8 (charmap\u003dUTF-8)\n\u003e \n\u003e Versions of packages dash depends on:\n\u003e ii  libc6                         2.3.6-15   GNU C Library: Shared libraries\n\u003e \n\u003e dash recommends no packages.\n\u003e \n\u003e -- debconf information:\n\u003e * dash/sh: false\n\u003e \n\u003e -- \n\u003e Andrea Mennucc\n\u003e  \"E\u0027 un mondo difficile. Che vita intensa!\" (Tonino Carotone)\n\nThis patch fixes handling of embedded NULs using an approach similar\nto the one taken by NetBSD.  In particular, we first determine the\nlength of the output string, and then use a sequence of Xs of the\nsame length as input to the underlying C printf to determine the\namount of leading and trailing padding.  Finally we replace the\nXs with the actual string before writing it out.\n\nIn order to print out the temporary string containing Xs and padding,\na new helper xasprintf is added.  Unlike asprintf though, our\nxasprintf prints to the ash stack rather than using straight malloc\nmemory.\n\nSigned-off-by: Herbert Xu \u003cherbert@gondor.apana.org.au\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "46ef4c2872c518eb3ce563339baeff139b1924ec",
      "old_mode": 33188,
      "old_path": "ChangeLog",
      "new_id": "379672f6d5f985f763a925500f0de9a041cec589",
      "new_mode": 33188,
      "new_path": "ChangeLog"
    },
    {
      "type": "modify",
      "old_id": "e0ef912dfd3d6532152ef0a1b84808eb15042d99",
      "old_mode": 33188,
      "old_path": "src/bltin/printf.c",
      "new_id": "213025f2b350b0e1f688a89770b774e2858b27a7",
      "new_mode": 33188,
      "new_path": "src/bltin/printf.c"
    },
    {
      "type": "modify",
      "old_id": "f62e7eab0b4eb4eae0e76a1a9d16b52674fc6d81",
      "old_mode": 33188,
      "old_path": "src/output.c",
      "new_id": "1b20850a81f7526f4fb1eca0c85c405e2a5d150a",
      "new_mode": 33188,
      "new_path": "src/output.c"
    },
    {
      "type": "modify",
      "old_id": "f853e9df65c12393a49ce1cfd1e2f00eb683e024",
      "old_mode": 33188,
      "old_path": "src/output.h",
      "new_id": "c43d493766c07a51691f08497f435e4e07ec6b93",
      "new_mode": 33188,
      "new_path": "src/output.h"
    }
  ]
}
