Commit 74cf566d authored by David Lawrence's avatar David Lawrence
Browse files

"context.c", line 195: remark(1506): implicit conversion from "unsigned int"

          to "long":  rounding, sign extension, or loss of accuracy may result

Fixed by ensuring unsigned long ctx->timeout does not overflow the signed
long timeout.tv_sec.
parent 65ec49af
......@@ -18,6 +18,7 @@
#include <config.h>
#include <fcntl.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
......@@ -192,7 +193,16 @@ lwres_context_sendrecv(lwres_context_t *ctx,
fd_set readfds;
struct timeval timeout;
timeout.tv_sec = ctx->timeout;
* Type of tv_sec is long, so make sure the unsigned long timeout
* does not overflow it.
if (ctx->timeout <= LONG_MAX)
timeout.tv_sec = (long)ctx->timeout;
timeout.tv_sec = LONG_MAX;
timeout.tv_usec = 0;
ret = sendto(ctx->sock, sendbase, sendlen, 0, NULL, 0);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment