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).
This commit is contained in:
Qualys Security Advisory - committed by Craig Small
parent 4ce81d4dcc
commit b4f4718481

View File

@ -909,7 +909,7 @@ int main(int argc, char *argv[])
case 'p':
statMode |= PARTITIONSTAT;
partition = optarg;
if (memcmp(partition, "/dev/", 5) == 0)
if (strncmp(partition, "/dev/", 5) == 0)
partition += 5;
break;
case 'S':