From db9268ee7883a6ee82e81e048da4e9f5a0fe0eef Mon Sep 17 00:00:00 2001 From: mmex Date: Fri, 11 Jul 2003 01:37:28 +0000 Subject: [PATCH] - fix buffer overrun in openfile - add test 39 which tests for mtime change on file creat --- lustre/tests/openfile.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lustre/tests/openfile.c b/lustre/tests/openfile.c index 7d8cc6b..7b97309 100644 --- a/lustre/tests/openfile.c +++ b/lustre/tests/openfile.c @@ -18,8 +18,8 @@ #include typedef struct flag_mapping { - char string[20]; - int flag; + const char *string; + const int flag; } FLAG_MAPPING; FLAG_MAPPING flag_table[] = { @@ -67,13 +67,13 @@ int main(int argc, char** argv) case 'f': { char *tmp; - cloned_flags = (char *)malloc(strlen(optarg)); + cloned_flags = (char *)malloc(strlen(optarg)+1); if (cloned_flags == NULL) { fprintf(stderr, "Insufficient memory.\n"); exit(-1); } - strncpy(cloned_flags, optarg, strlen(optarg)); + strncpy(cloned_flags, optarg, strlen(optarg)+1); for (tmp = strtok(optarg, ":|"); tmp; tmp = strtok(NULL, ":|")) { int i = 0; -- 1.8.3.1