lkml.org 
[lkml]   [2014]   [Jun]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6 3/6] KEYS: make partial key id matching as a dedicated function
On 27/06/14 16:38, David Howells wrote:
> Mimi Zohar <zohar@linux.vnet.ibm.com> wrote:
>
>> + if (strncmp(id, "id:", 3) == 0)

>> Use memcmp() here.

'id' function parameter comes from "keys_ownerid" kernel parameter.
User can supply anything shorter than "id:".
Though comparing 3 bytes should not produce any memory access errors,
memcmp can access beyond the length of the string.
I think 'strcnmp' is more appropriate here...


>> - kid += kidlen - idlen;
>> - if (strcasecmp(id, kid) != 0)
>> - return 0;
> This test is no longer applied in the "<subtype>:..." case.

I did not get fully what you comment here or ask to do..
But yes, with this patch, it is no longer the case.

Thanks,
Dmitry

> David
> --
> To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>



\
 
 \ /
  Last update: 2014-06-30 23:21    [W:0.070 / U:23.900 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site