(Both are rounded up to the page size: v3 ≈ 0x2000, buf ≈ 0x1000.)
Menu 5 prints the addresses of v3 and buf (providing an ASLR leak).
Menu 2 reads ./flag into v3 (0x64 bytes).
Menu 3 executes write(1, buf, nbytes)WITHOUT limits -> this allows an OOB (Out-Of-Bounds) read starting from buf and continuing to higher addresses.
Linux typically places anonymous mmaps "downwards" (meaning the first mapping is at a higher address). Since v3 is allocated first, address(v3) > address(buf), and they are usually located on adjacent pages. Therefore, if we request nbytes = (v3 - buf) + 0x64, the "Full Diagnostic Log" output will read past buf, cross the page boundary into v3, and capture the 0x64 bytes of the flag.