]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix bindresvport_sa port byte swap bug
authorGreg Hudson <ghudson@mit.edu>
Tue, 19 May 2015 14:38:51 +0000 (10:38 -0400)
committerTom Yu <tlyu@mit.edu>
Wed, 24 Jun 2015 22:07:59 +0000 (18:07 -0400)
The sa_setport() helper handles conversion to network byte order, so
bindresvport_sa() should not itself call htons() on the port argument.

(This bug was introduced in commit
0d04b60d159ab83b943e43802b1449a3b074bc83 when adding
bindresvport_sa().  It was my fault, not Andreas Schneider's.)

(cherry picked from commit 5c6d218e385755766ff427b3e707510f0ce175c5)

ticket: 8197
version_fixed: 1.13.3
status: resolved

src/lib/rpc/bindresvport.c

index ccc4d73c6b1ae3e354c66867b1a8329c3fafbed0..a421dd8ec770a307ba2714a9a105f73ab346bdcf 100644 (file)
@@ -76,7 +76,7 @@ bindresvport_sa(int sd, struct sockaddr *sa)
        res = -1;
        errno = EADDRINUSE;
        for (i = 0; i < NPORTS && res < 0 && errno == EADDRINUSE; i++) {
-               sa_setport(sa, htons(port++));
+               sa_setport(sa, port++);
                if (port > ENDPORT) {
                        port = STARTPORT;
                }