This code is old and convoluted enough to make patching unfeasible; once we modernize our stack, the port should be updated as appropriate.