Limit switch protected against overload