Use copy of input length in goroutine

Access to the input slice from inside the goroutine and the main routine
leads to a data race.