printf-hook-builtin: Correctly calculate written bytes in print_in_hook()