[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1758221706.1851628.1354048105347.JavaMail.root@redhat.com>
Date: Tue, 27 Nov 2012 15:28:25 -0500 (EST)
From: Tomas Hozza <thozza@...hat.com>
To: Ben Hutchings <ben@...adent.org.uk>
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
----- Original Message -----
> 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.
This is just for sanity. The value PATH_MAX was chosen after discussion
with K. Y. Srinivasan and Olaf Hering instead of some "magic" number like
256 or 512.
> Using snprintf() is a good idea, but you need to check the return
> value and handle the truncation case somehow.
By using PATH_MAX sized buffer there is no need for handling the truncation
case.
Tomas Hozza
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists