[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAOD=uF6GizMhTWkriQCnV7T_2vzOSQ85sG1ruoEi_YtNSK+9kQ@mail.gmail.com>
Date: Thu, 1 Mar 2012 19:21:45 +0530
From: santosh prasad nayak <santoshprasadnayak@...il.com>
To: Pablo Neira Ayuso <pablo@...filter.org>
Cc: bart.de.schuymer@...dora.be, kaber@...sh.net,
shemminger@...tta.com, davem@...emloft.net,
netfilter-devel@...r.kernel.org, bridge@...ts.linux-foundation.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org,
Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: [PATCH 1/3] netfilter: Fix copy_to_user too small size parametre.
Thanks Pablo for clarification.
I will resend the patch.
regards
santosh
On Thu, Mar 1, 2012 at 6:33 PM, Pablo Neira Ayuso <pablo@...filter.org> wrote:
> On Thu, Mar 01, 2012 at 04:15:05PM +0530, santosh prasad nayak wrote:
>> Hi Pablo.
>>
>> copy_to_user( dest, source, length)
>>
>> Normally, 'length' is equal to 'sizeof (source) '.
>>
>> In this case "length" = 32
>> "sizeof(source)" = 29.
>>
>> Is it intentional ?
>
> ebtables expects 32 bytes names.
>
>> Won't it copy extra 3 bytes of kernel data to userspace ?
>
> You're right. We have to copy 29 bytes but we have to fill the
> remaining bytes with zeroes. I think something like:
>
> char name[EBT_FUNCTION_MAXNAMELEN] = {};
>
> /* user-space ebtables expects 32 bytes-long names, but xt_match uses
> * 29 bytes for that. */
> sprintf(name, "%s", m->u.match->name);
> if (copy_to_user(hlp, name, EBT_FUNCTION_MAXNAMELEN))
> ...
>
> will resolve this issue.
>
> Would you resend a new patch?
--
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