vmstat: -p handles /dev/ and does not overflow #319523 #330969

This commit is contained in:
albert 2005-10-30 06:03:28 +00:00
parent 73030f7346
commit 36524ac0fd
2 changed files with 7 additions and 4 deletions

1
NEWS
View File

@ -10,6 +10,7 @@ ps: fix crash related to realloc -- thanks David Houlder
ps: man page more detailed #334682
spelling fixes #300333 #334684 #334685
top: crash on resize fixed -- thanks Michal Maruska #320289
vmstat: -p handles /dev/ and does not overflow #319523 #330969
procps-3.2.4 --> procps-3.2.5

View File

@ -608,9 +608,11 @@ int main(int argc, char *argv[]) {
case 'p':
statMode |= PARTITIONSTAT;
if (argv[1]){
++argv;
sprintf(partition, "%s", *argv);
}else{fprintf(stderr, "-p requires an argument\n");
char *cp = *++argv;
if(!memcmp(cp,"/dev/",5)) cp += 5;
snprintf(partition, sizeof partition, "%s", cp);
}else{
fprintf(stderr, "-p requires an argument\n");
exit(EXIT_FAILURE);
}
break;