Re: [patch] cifs: writing past the end of the array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 08, 2011 at 09:25:36AM +0100, walter harms wrote:
> >>> --- a/fs/cifs/smbencrypt.c
> >>> +++ b/fs/cifs/smbencrypt.c
> >>> @@ -353,7 +353,7 @@ SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24)
> >>>  	int rc;
> >>>  	unsigned char p16[16], p21[21];
> >>>  
> >>> -	memset(p16, '\0', 21);
> >>> +	memset(p16, '\0', 16);
> >>>  	memset(p21, '\0', 21);
> >>>  
> >>>  	rc = E_md4hash(passwd, p16);
> >>
> >>
> >> perhaps ARRAY_SIZE() instead of a magic number is a better choice ?
> >>
> > 
> > Agreed. Care to propose a patch? There are almost certainly other
> > places in the code that could use a similar cleanup.
> > 
> 
> Dan, i think he is sending to you :)
> 

Nah, man.  He's talking to you.  :P

The 16 can't change.  It's built into the name.  Also you should
probably use sizeof() instead of ARRAY_SIZE().  They're the same in this
case because it's type char but sizeof is more standard.

regards,
dan carpenter

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


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux