Well, one can replace "find all possible paths" with "find all possible paths with total length less than the threshold". That's a little better. You can reject any proposed route as soon as it exceeds the max allowable length. Still, this could well be computationally intractable if the threshold is too high. Maybe that's unavoidable, maybe not.
Marilyn, can you elaborate at all on the "with certain constraints"?
It might be worthwhile to look at
Dijstra's algorithm for some ideas. As a first step, you could calculate the minimum distance from endpoint b for every point on the map. At least, every point within the threshold. Then as you walk "every possible path" starting from a, you can reject a path as soon as [current distance from a] + [minimum distance from b] > [threshold distance]. Early rejection is essential to minimize time wasted on paths that can't possibly pan out.