[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51BA253B.4010701@redhat.com>
Date: Thu, 13 Jun 2013 22:02:03 +0200
From: Daniel Borkmann <dborkman@...hat.com>
To: Ben Hutchings <bhutchings@...arflare.com>
CC: David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH net] packet: packet_getname_spkt: make sure string is
always 0-terminated
On 06/13/2013 07:05 PM, Ben Hutchings wrote:
> On Thu, 2013-06-13 at 01:38 -0700, David Miller wrote:
>> From: Daniel Borkmann <dborkman@...hat.com>
>> Date: Wed, 12 Jun 2013 16:02:27 +0200
>>
>>> uaddr->sa_data is exactly of size 14, which is hard-coded here and
>>> passed as a size argument to strncpy(). A device name can be of size
>>> IFNAMSIZ (== 16), meaning we might leave the destination string
>>> unterminated. Thus, use strlcpy() and also sizeof() while we're
>>> at it. We need to memset the data area beforehand, since strlcpy
>>> does not padd the remaining buffer with zeroes for user space, so
>>> that we do not possibly leak anything.
>>>
>>> Signed-off-by: Daniel Borkmann <dborkman@...hat.com>
>>
>> Applied, and queued up for -stable, thanks.
>
> I don't think this should be applied anywhere. Dropping support for
> 14-character device names is a regression.
I don't think this would be reasonable, because it can pose a security
risk for user space. In all other cases, we null-terminate the string, so
people might trust what they get from the kernel and expect this to happen
except in this particular border case.
I agree that this is pretty broken, but I would say it's a bug in the kernel
that can potentially cause user space to crash (or worse) that is making use
of this. There also seems to be no man page documentation about it, only that
spkt is heavily deprecated from what I read, and shouldn't be used nowadays.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists