From: René Scharfe Date: Sat, 31 Oct 2015 17:36:35 +0000 (+0100) Subject: wt-status: avoid building bogus branch name with detached HEAD X-Git-Tag: v2.6.3~2^2~2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/baf0a3e47d807b63e9fc5628caa455d1da91dd6c?hp=baf0a3e47d807b63e9fc5628caa455d1da91dd6c wt-status: avoid building bogus branch name with detached HEAD If we're on a detached HEAD then wt_shortstatus_print_tracking() takes the string "HEAD (no branch)", translates it, skips the first eleven characters and passes the result to branch_get(), which returns a bogus result and accesses memory out of bounds in order to produce it. Somehow stat_tracking_info(), which is passed that result, does the right thing anyway, i.e. it finds that there is no base. Avoid the bogus results and memory accesses by checking for HEAD first and exiting early in that case. This fixes t7060 with --valgrind. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano ---