mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-06 05:02:31 +00:00
getdelays.c: fix overrun
A patch for getdelays.c that fixes a buffer overrun when you set -w. Cc: <matt@bluehost.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
d1ab824be4
commit
7f76c40375
@ -61,8 +61,6 @@ __u64 stime, utime;
|
|||||||
#define MAX_MSG_SIZE 1024
|
#define MAX_MSG_SIZE 1024
|
||||||
/* Maximum number of cpus expected to be specified in a cpumask */
|
/* Maximum number of cpus expected to be specified in a cpumask */
|
||||||
#define MAX_CPUS 32
|
#define MAX_CPUS 32
|
||||||
/* Maximum length of pathname to log file */
|
|
||||||
#define MAX_FILENAME 256
|
|
||||||
|
|
||||||
struct msgtemplate {
|
struct msgtemplate {
|
||||||
struct nlmsghdr n;
|
struct nlmsghdr n;
|
||||||
@ -231,7 +229,7 @@ int main(int argc, char *argv[])
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
int write_file = 0;
|
int write_file = 0;
|
||||||
int maskset = 0;
|
int maskset = 0;
|
||||||
char logfile[128];
|
char *logfile = NULL;
|
||||||
int loop = 0;
|
int loop = 0;
|
||||||
|
|
||||||
struct msgtemplate msg;
|
struct msgtemplate msg;
|
||||||
@ -251,7 +249,7 @@ int main(int argc, char *argv[])
|
|||||||
print_io_accounting = 1;
|
print_io_accounting = 1;
|
||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
strncpy(logfile, optarg, MAX_FILENAME);
|
logfile = strdup(optarg);
|
||||||
printf("write to file %s\n", logfile);
|
printf("write to file %s\n", logfile);
|
||||||
write_file = 1;
|
write_file = 1;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user