diff options
author | eadler <eadler@FreeBSD.org> | 2012-03-04 16:39:08 +0000 |
---|---|---|
committer | eadler <eadler@FreeBSD.org> | 2012-03-04 16:39:08 +0000 |
commit | 47d5c92c94b33a3eb80d6efa5f6e811af803179c (patch) | |
tree | 866b9ecf086f1897f52a6808bdbf7e84a625cea3 /lib/libc/string/swab.c | |
parent | 2c21c36313d7c9853eaca967a13499c5db0100aa (diff) | |
download | FreeBSD-src-47d5c92c94b33a3eb80d6efa5f6e811af803179c.zip FreeBSD-src-47d5c92c94b33a3eb80d6efa5f6e811af803179c.tar.gz |
POSIX mandates that swab do nothing when len < 0
PR: kern/140690
Submitted by: Jeremy Huddleston <jeremyhu@apple.com>
Approved by: cperciva
MFC after: 2 weeks
Diffstat (limited to 'lib/libc/string/swab.c')
-rw-r--r-- | lib/libc/string/swab.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/libc/string/swab.c b/lib/libc/string/swab.c index 1db7d1f..ec6cbf0 100644 --- a/lib/libc/string/swab.c +++ b/lib/libc/string/swab.c @@ -45,6 +45,8 @@ swab(const void * __restrict from, void * __restrict to, ssize_t len) int n; char *fp, *tp; + if (len <= 0) + return; n = len >> 1; fp = (char *)from; tp = (char *)to; |