Fix get_magic() handling of short reads.

PR16389