[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1354027837.4266.52.camel@deadeye.wl.decadent.org.uk>
Date: Tue, 27 Nov 2012 14:50:37 +0000
From: Ben Hutchings <ben@...adent.org.uk>
To: Tomas Hozza <thozza@...hat.com>
Cc: gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
devel@...uxdriverproject.org, olaf@...fle.de, apw@...onical.com,
jasowang@...hat.com, kys@...rosoft.com
Subject: Re: [PATCH 1/3] tools/hv: Fix for long file names from readdir
On Tue, 2012-11-27 at 08:56 +0100, Tomas Hozza wrote:
> kvp_get_if_name and kvp_mac_to_if_name copy strings into statically
> sized buffers which could be too small to store really long names.
>
> Buffer sizes have been changed to PATH_MAX, include "limits.h" where
> PATH_MAX is defined was added and length checks ware added via snprintf.
[...]
PATH_MAX has nothing to do with any actual kernel limit; it's no more
meaningful than the current value of 256. Network interface names are
limited to 15 characters, thus the current array is more than long
enough. So I think this is entirely unnecessary.
Using snprintf() is a good idea, but you need to check the return value
and handle the truncation case somehow.
Ben.
--
Ben Hutchings
Never attribute to conspiracy what can adequately be explained by stupidity.
Download attachment "signature.asc" of type "application/pgp-signature" (829 bytes)
Powered by blists - more mailing lists