diff options
author | Viktor Dukhovni <viktor@twosigma.com> | 2013-06-25 12:27:42 -0400 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2013-06-26 01:54:03 -0400 |
commit | 53e5c850e05f011e9e7f25c2032aec51d8b352a9 (patch) | |
tree | e0ea9c6f6bbacde38d215590668c5c8dabb38d88 /src | |
parent | 7bca89626e53f258397818a9b0d838a0a3e00f5b (diff) | |
download | krb5-53e5c850e05f011e9e7f25c2032aec51d8b352a9.tar.gz krb5-53e5c850e05f011e9e7f25c2032aec51d8b352a9.tar.xz krb5-53e5c850e05f011e9e7f25c2032aec51d8b352a9.zip |
Fix spin loop reading from KDC TCP socket
In the k5_sendto code for reading from a TCP socket, detect
end-of-stream when reading the length. Otherwise we can get stuck in
an infinite loop of poll() and read().
[ghudson@mit.edu: commit message]
ticket: 7508
target_version: 1.11.4
tags: pullup
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/krb5/os/sendto_kdc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/krb5/os/sendto_kdc.c b/src/lib/krb5/os/sendto_kdc.c index 3e4ec7e9b..3c31d9f55 100644 --- a/src/lib/krb5/os/sendto_kdc.c +++ b/src/lib/krb5/os/sendto_kdc.c @@ -853,9 +853,9 @@ service_tcp_fd(krb5_context context, struct conn_state *conn, nread = SOCKET_READ(conn->fd, conn->x.in.bufsizebytes + conn->x.in.bufsizebytes_read, 4 - conn->x.in.bufsizebytes_read); - if (nread < 0) { + if (nread <= 0) { + e = nread ? SOCKET_ERRNO : ECONNRESET; TRACE_SENDTO_KDC_TCP_ERROR_RECV_LEN(context, &conn->addr, e); - e = SOCKET_ERRNO; goto kill_conn; } conn->x.in.bufsizebytes_read += nread; |