Package: boinc / 7.14.2+dfsg-3

more_maxpathlen.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Description: use MAXPATHLEN and change sprintf to snprintf
--- a/api/graphics2_util.cpp
+++ b/api/graphics2_util.cpp
@@ -40,7 +40,7 @@
 static key_t get_shmem_name(const char* prog_name) {
     char cwd[MAXPATHLEN], path[MAXPATHLEN];
     boinc_getcwd(cwd);
-    sprintf(path, "%s/init_data.xml", cwd);
+    snprintf(path, sizeof(path), "%s/init_data.xml", cwd);
     return ftok(path, 2);
 }
 #else
@@ -50,7 +50,7 @@
     APP_INIT_DATA aid;
     int retval = boinc_get_init_data(aid);
     if (retval) aid.slot = 0;
-    sprintf(shmem_name, "boinc_%s_%d", prog_name, aid.slot);
+    snprintf(shmem_name, MAXPATHLEN, "boinc_%s_%d", prog_name, aid.slot);
 }
 #endif
 
--- a/lib/filesys.cpp
+++ b/lib/filesys.cpp
@@ -598,7 +598,7 @@ int boinc_copy(const char* orig, const char* newf) {
     }
     return 0;
 #elif defined(__EMX__)
-    char cmd[2*MAXPATHLEN];
+    char cmd[2*MAXPATHLEN+5];
     snprintf(cmd, sizeof(cmd), "copy \"%s\" \"%s\"", orig, newf);
     cmd[sizeof(cmd)-1] = 0;
     return system(cmd);