Re: [conntrack-utils PATCH r7285 07/11] use size_t

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Max Kellermann wrote:
> ---
> 
>  include/mcast.h   |    4 ++--
>  include/network.h |    7 ++++---
>  src/build.c       |    2 +-
>  src/local.c       |    4 ++--
>  src/mcast.c       |    8 ++++----
>  src/network.c     |   22 +++++++++++-----------
>  src/sync-alarm.c  |    2 +-
>  src/sync-ftfw.c   |    4 ++--
>  src/sync-mode.c   |   11 ++++++-----
>  9 files changed, 33 insertions(+), 31 deletions(-)

Applied with a minor change.

> --- a/src/sync-mode.c
> +++ b/src/sync-mode.c
> @@ -88,14 +88,15 @@ retry:
>  /* handler for multicast messages received */
>  static void mcast_handler(void)
>  {
> -	int numbytes, remain;
> +	ssize_t numbytes;
> +	size_t remain;
>  	char __net[65536], *ptr = __net; /* XXX: maximum MTU for IPv4 */
>  
>  	numbytes = mcast_recv(STATE_SYNC(mcast_server), __net, sizeof(__net));
>  	if (numbytes <= 0)
>  		return;
>  
> -	remain = numbytes;
> +	remain = (size_t)numbytes;
>  	while (remain > 0) {
>  		struct nethdr *net = (struct nethdr *) ptr;

I have kept remain signed since a malformed header can result in an
overflow.

-- 
"Los honestos son inadaptados sociales" -- Les Luthiers
-
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux