0123-vmstat: Replace memcmp() with strncmp().
Otherwise this may read out-of-bounds (there is no guarantee that 5 bytes are actually available at partition/optarg). Signed-off-by: Craig Small <csmall@enc.com.au>
This commit is contained in:
parent
e37e4528d0
commit
c7e17f4439
2
vmstat.c
2
vmstat.c
@ -941,7 +941,7 @@ int main(int argc, char *argv[])
|
|||||||
case 'p':
|
case 'p':
|
||||||
statMode |= PARTITIONSTAT;
|
statMode |= PARTITIONSTAT;
|
||||||
partition = optarg;
|
partition = optarg;
|
||||||
if (memcmp(partition, "/dev/", 5) == 0)
|
if (strncmp(partition, "/dev/", 5) == 0)
|
||||||
partition += 5;
|
partition += 5;
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user