Browse Source

Bugfix: Put kernel path on the (main) stack after initialisation from commandline/config, to avoid appending an argv or jansson string

Luke Dashjr 12 years ago
parent
commit
a3b12c6345
1 changed files with 5 additions and 3 deletions
  1. 5 3
      miner.c

+ 5 - 3
miner.c

@@ -7443,8 +7443,7 @@ int main(int argc, char *argv[])
 #ifndef WIN32
 #ifndef WIN32
 	signal(SIGPIPE, SIG_IGN);
 	signal(SIGPIPE, SIG_IGN);
 #endif
 #endif
-	opt_kernel_path = alloca(PATH_MAX);
-	strcpy(opt_kernel_path, CGMINER_PREFIX);
+	opt_kernel_path = CGMINER_PREFIX;
 	cgminer_path = alloca(PATH_MAX);
 	cgminer_path = alloca(PATH_MAX);
 	s = strdup(argv[0]);
 	s = strdup(argv[0]);
 	strcpy(cgminer_path, dirname(s));
 	strcpy(cgminer_path, dirname(s));
@@ -7547,7 +7546,10 @@ int main(int argc, char *argv[])
 		cnfbuf = NULL;
 		cnfbuf = NULL;
 	}
 	}
 
 
-	strcat(opt_kernel_path, "/");
+	i = strlen(opt_kernel_path) + 2;
+	char __kernel_path[i];
+	snprintf(__kernel_path, i, "%s/", opt_kernel_path);
+	opt_kernel_path = __kernel_path;
 
 
 	if (want_per_device_stats)
 	if (want_per_device_stats)
 		opt_log_output = true;
 		opt_log_output = true;