"What's to prevent any company from copyrighting a small passage of code and then rigorously suing everyone and their brother for it?"
Independent creation is a strong defense to copyright infringement. Compaq famously did this when they duplicated the functionality of the original IBM PC firmware, by using a strict "clean room" process. Even though numerous segments of code were no doubt duplicated, because there is often a single best way of writing hand-optimized assembly language, the provable independent creation made it a new work under copyright law. As far as I remember, IBM didn't even bother to sue.
Independent creation is a strong defense to copyright infringement. Compaq famously did this when they duplicated the functionality of the original IBM PC firmware, by using a strict "clean room" process. Even though numerous segments of code were no doubt duplicated, because there is often a single best way of writing hand-optimized assembly language, the provable independent creation made it a new work under copyright law. As far as I remember, IBM didn't even bother to sue.