Fix off-by-one error in size parsing in proc_ratesample_open()

sizeof("string") includes the trailing 0, strlen("string") doesn't.
This commit is contained in:
Pavel Roskin 2013-11-12 15:55:46 -05:00
parent e6cb21364b
commit 3f778edc5f

View File

@ -1050,7 +1050,7 @@ proc_ratesample_open(struct inode *inode, struct file *file)
/* Determine what size packets to get stats for based on proc filename */ /* Determine what size packets to get stats for based on proc filename */
size = simple_strtoul(file->f_dentry->d_name.name + size = simple_strtoul(file->f_dentry->d_name.name +
sizeof("ratestats_"), NULL, 0); strlen("ratestats_"), NULL, 0);
if (size < 250 || size > 3000) if (size < 250 || size > 3000)
return -ENOENT; return -ENOENT;