Browse Source

Fix buffer overflow

Samuel Thibault 11 years ago
parent
commit
7e4f845927
1 changed files with 2 additions and 3 deletions
  1. 2 3
      src/core/disk_ops/disk_stdio.c

+ 2 - 3
src/core/disk_ops/disk_stdio.c

@@ -55,10 +55,9 @@ starpu_stdio_alloc (void *base, size_t size)
 	int id = -1;
 
 	/* create template for mkstemp */
-	char * baseCpy = malloc(strlen(base)+8);
-	STARPU_ASSERT(baseCpy != NULL);
-
 	char * tmp = "STARPU_XXXXXX";
+	char * baseCpy = malloc(strlen(base)+1+strlen(tmp)+1);
+	STARPU_ASSERT(baseCpy != NULL);
 
 	strcpy(baseCpy, (char *) base);
 	strcat(baseCpy,"/");