mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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
This commit is contained in:
parent
c0f0c9848e
commit
0a0c8e010d
2 changed files with 6 additions and 1 deletions
|
|
@ -28,7 +28,7 @@
|
|||
.\" @(#)swab.3 8.1 (Berkeley) 6/4/93
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd December 10, 2004
|
||||
.Dd March 4, 2012
|
||||
.Dt SWAB 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
|
@ -54,6 +54,9 @@ swapping adjacent bytes.
|
|||
The argument
|
||||
.Fa len
|
||||
must be an even number.
|
||||
If
|
||||
.Fa len
|
||||
is less than zero, nothing will be done.
|
||||
.Sh SEE ALSO
|
||||
.Xr bzero 3 ,
|
||||
.Xr memset 3
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue