Fix off-by-one error in size parsing in proc_ratesample_open()
authorPavel Roskin <proski@gnu.org>
Tue, 12 Nov 2013 20:55:46 +0000 (15:55 -0500)
committerPavel Roskin <proski@gnu.org>
Tue, 12 Nov 2013 20:55:46 +0000 (15:55 -0500)
sizeof("string") includes the trailing 0, strlen("string") doesn't.

ath_rate/sample/sample.c

index 5baaf8c7583f074822e4ec838cb55f6b2da98514..01ccfbab5861a753e776a521e3e94ccb45b579f2 100644 (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 */
        size = simple_strtoul(file->f_dentry->d_name.name +
-                             sizeof("ratestats_"), NULL, 0);
+                             strlen("ratestats_"), NULL, 0);
        if (size < 250 || size > 3000)
                return -ENOENT;