this function is specified to leave the last byte with "unspecified
disposition" when the length is odd, so for the most part correct
programs should not be calling swab with odd lengths. however, doing
so is permitted, and should not write past the end of the destination
buffer.
(cherry picked from commit
dccbf4c809efc311aa37da71de70d04dfd8b0db3)
{
const char *src = _src;
char *dest = _dest;
- for (; n>0; n-=2) {
+ for (; n>1; n-=2) {
dest[0] = src[1];
dest[1] = src[0];
dest += 2;