Prechádzať zdrojové kódy

Kompiliert nun auch für PC

Rind 3 rokov pred
rodič
commit
e1433c0832
1 zmenil súbory, kde vykonal 3 pridanie a 3 odobranie
  1. 3 3
      src/gfaserial.c

+ 3 - 3
src/gfaserial.c

@@ -83,7 +83,7 @@ static int _GetDeviceAccess(const char *pszDev)
 		DIR *pd;
 		const char *pszRp;
 		const struct dirent *pde, *pde2;
-		char szDir[512], szPath[512], szRealPath[512];
+        char szDir[PATH_MAX], szPath[PATH_MAX], szRealPath[PATH_MAX];
 
 		if((pd = opendir("/proc")))
 		{
@@ -92,7 +92,7 @@ static int _GetDeviceAccess(const char *pszDev)
 				if(pde->d_type == DT_DIR && isdigit(*pde->d_name))
 				{
 					DIR *pd2;
-					sprintf(szDir, "/proc/%s/fd", pde->d_name);
+                    snprintf(szDir, sizeof(szDir), "/proc/%s/fd", pde->d_name);
 
 					if((pd2 = opendir(szDir)))
 					{
@@ -100,7 +100,7 @@ static int _GetDeviceAccess(const char *pszDev)
 						{
 							if(pde2->d_type == DT_LNK)
 							{
-								sprintf(szPath, "%s/%s", szDir, pde2->d_name);
+                                snprintf(szPath, sizeof(szPath), "%s/%s", szDir, pde2->d_name);
 
 								if((pszRp = realpath(szPath, szRealPath)))
 								{