)]}'
{
  "commit": "f5dfc96063fef2d9c5446d0733867d899ef9b942",
  "tree": "6ac984dc8f183ee7a716354ceba0861a01f09dac",
  "parents": [
    "7bfa6b4c2fff91762a21da316a3f483104647d02"
  ],
  "author": {
    "name": "Naveed Khan",
    "email": "naveed@digiscrypt.com",
    "time": "Sat Jul 11 22:18:43 2026 +0530"
  },
  "committer": {
    "name": "Mark Wielaard",
    "email": "mark@klomp.org",
    "time": "Sun Jul 12 00:14:43 2026 +0200"
  },
  "message": "bzip2recover: create output block files safely with O_EXCL\n\nbzip2recover writes each recovered block to a file whose name is fully\npredictable (\"recNNNNN\" + basename of the input, e.g. rec00001foo.bz2)\nand which is created in the directory of the input file.  The output\nfile was opened with a plain fopen(outFileName, \"wb\"), which follows\nsymbolic links and truncates whatever it finds.\n\nIf the input file lives in a directory that an attacker can write to\n(a shared spool/incoming directory, or any directory whose path the\nattacker supplied), the attacker can pre-create a symlink at the\npredictable output name pointing at an arbitrary file.  When the victim\nruns bzip2recover, the plain fopen follows that symlink and overwrites\nthe target (CWE-59).  Existing regular files are likewise clobbered,\nand the files are created with lax umask permissions.\n\nThe main bzip2 tool already guards against this in fopen_output_safely()\nby creating output files with open(O_WRONLY|O_CREAT|O_EXCL, S_IWUSR|\nS_IRUSR); bzip2recover was never given the same treatment.  Add a small\nfopenOutputSafely() helper mirroring that function and use it for the\nblock files: O_EXCL makes the create fail rather than follow a symlink\nor overwrite an existing file, and the mode creates the file 0600.\nNon-Unix builds keep the previous fopen behaviour.\n\nSigned-off-by: Naveed Khan \u003cnaveed@digiscrypt.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "e6c0a9987544d53c67801afa57f5cb440fb7322d",
      "old_mode": 33188,
      "old_path": "bzip2recover.c",
      "new_id": "c17206b6473bbe4aaa398307fdd47fdfad363c91",
      "new_mode": 33188,
      "new_path": "bzip2recover.c"
    }
  ]
}
