Check your local laws is good advice. The Federal minimum barrel length for rifles is 16", but some states may have a higher limit. There is also a minimum overall length for rifles, but I don't know what it is. There is no Federal limit on the length of a pistol barrel, so you can have a pistol with as long a barrel as you wish, but, again, there may be state law problems. Check your state laws.
RonF