Software code is automatically protected by copyright. The person who wrote it (or his/her employer) will usually own the copyright and can take legal action against people who copy it without permission.