Stroke simply uses dots as its brush and that means they overshoot the end of the actual mask path. As to whether you choose to crop it afterwards e.g. by using a track matte that defines the bounds of the effect is entirely up to you. You really just need to better understand how this works in general, there is nothing wrong here in the technical sense.
Explain on how I can fix this?