aboutsummaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorScott Wiersdorf <scott@bluehost.com>2007-05-08 00:30:25 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 11:15:12 -0700
commit7f76c403751ab917b2ebed5663079a6b2956eebd (patch)
tree7704e45081d38e44f7f6dc717eab67220ac781fd /Documentation
parentd1ab824be43842ae7429ab1df37153e1cebb4d32 (diff)
downloadlinux-7f76c403751ab917b2ebed5663079a6b2956eebd.tar.gz
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>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/accounting/getdelays.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
index 6207e2f59e3..71acc28ed0d 100644
--- a/Documentation/accounting/getdelays.c
+++ b/Documentation/accounting/getdelays.c
@@ -61,8 +61,6 @@ __u64 stime, utime;
#define MAX_MSG_SIZE 1024
/* Maximum number of cpus expected to be specified in a cpumask */
#define MAX_CPUS 32
-/* Maximum length of pathname to log file */
-#define MAX_FILENAME 256
struct msgtemplate {
struct nlmsghdr n;
@@ -231,7 +229,7 @@ int main(int argc, char *argv[])
int count = 0;
int write_file = 0;
int maskset = 0;
- char logfile[128];
+ char *logfile = NULL;
int loop = 0;
struct msgtemplate msg;
@@ -251,7 +249,7 @@ int main(int argc, char *argv[])
print_io_accounting = 1;
break;
case 'w':
- strncpy(logfile, optarg, MAX_FILENAME);
+ logfile = strdup(optarg);
printf("write to file %s\n", logfile);
write_file = 1;
break;