Subject: Re: [patch] isdn: make sure strings are null terminated

From: Dan Carpenter <[email-masked]>
Date: Wed, 23 Nov 2011 10:16:20 +0300

On Wed, Nov 23, 2011 at 08:03:31AM +0100, Eric Dumazet wrote:
> > +			if (strlen(dioctl.cf_ctrl.msn) >= sizeof(dioctl.cf_ctrl.msn))
> > +				return -EINVAL;
> 
> This looks buggy.
> 
> If string is not null terminated, how strlen() will stop you from going
> out of bounds, and trigger some run time checker ?
> 
> strnlen() would be more effective...
> 

Aw crap.  My first version used strnlen() and I redid it to be
simpler.  I just figured that it doesn't take long to hit a zeroed
u8.

I'll resend all three strlen() patches to use strnlen().

regards,
dan carpenter