Browse Source

devpath_to_devid: *nix: Reject anything that doesn't begin with a /

Luke Dashjr 11 years ago
parent
commit
c6f6ffb962
1 changed files with 2 additions and 0 deletions
  1. 2 0
      miner.c

+ 2 - 0
miner.c

@@ -498,6 +498,8 @@ static void applog_and_exit(const char *fmt, ...)
 char *devpath_to_devid(const char *devpath)
 char *devpath_to_devid(const char *devpath)
 {
 {
 #ifndef WIN32
 #ifndef WIN32
+	if (devpath[0] != '/')
+		return NULL;
 	struct stat my_stat;
 	struct stat my_stat;
 	if (stat(devpath, &my_stat))
 	if (stat(devpath, &my_stat))
 		return NULL;
 		return NULL;