diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-03-02 14:32:54 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-03-02 14:32:54 +0100 |
commit | 4af0c6c0bcceab7640b943c56620b11302f6bb9b (patch) | |
tree | f78f76f29108955b2102af46ec090e51d781dbf2 /src | |
parent | 84413b1fe3811b2d07e0be4602c817580a3e4e92 (diff) | |
download | fastd-4af0c6c0bcceab7640b943c56620b11302f6bb9b.tar fastd-4af0c6c0bcceab7640b943c56620b11302f6bb9b.zip |
Don't crash on empty UDP packets
Diffstat (limited to 'src')
-rw-r--r-- | src/fastd.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/fastd.c b/src/fastd.c index d43784f..380f6a2 100644 --- a/src/fastd.c +++ b/src/fastd.c @@ -780,8 +780,8 @@ static void handle_socket(fastd_context_t *ctx, fastd_socket_t *sock) { socklen_t recvaddrlen = sizeof(recvaddr); ssize_t len = recvfrom(sock->fd, buffer.data, buffer.len, 0, (struct sockaddr*)&recvaddr, &recvaddrlen); - if (len < 0) { - if (errno != EINTR) + if (len <= 0) { + if (len < 0 && errno != EINTR) pr_warn(ctx, "recvfrom: %s", strerror(errno)); fastd_buffer_free(buffer); |