[SCM] BOINC packaging branch, master, updated. debian/6.10.17+dfsg-3-414-geec4d18

Steffen Moeller moeller at debian.org
Wed Mar 14 22:37:42 UTC 2012


The following commit has been merged in the master branch:
commit cfaf150616bc7586cf80a228b9fadd155596a02e
Author: Steffen Moeller <moeller at debian.org>
Date:   Fri Mar 9 14:09:32 2012 +0100

    Caveats while copying strings indicating filenames

diff --git a/debian/patches/sched_vda_strncpy.patch b/debian/patches/sched_vda_strncpy.patch
index 1783a80..d260e5e 100644
--- a/debian/patches/sched_vda_strncpy.patch
+++ b/debian/patches/sched_vda_strncpy.patch
@@ -1,20 +1,22 @@
 Index: boinc/vda/sched_vda.cpp
 ===================================================================
---- boinc.orig/vda/sched_vda.cpp	2012-03-03 01:12:31.000000000 +0100
-+++ boinc/vda/sched_vda.cpp	2012-03-03 12:13:55.000000000 +0100
-@@ -48,11 +48,13 @@
+--- boinc.orig/vda/sched_vda.cpp	2012-03-03 12:16:56.000000000 +0100
++++ boinc/vda/sched_vda.cpp	2012-03-03 12:55:38.000000000 +0100
+@@ -33,6 +33,8 @@
+ #include "vda_lib.h"
  
- typedef map<string, DB_VDA_CHUNK_HOST> CHUNK_LIST;
+ #include "sched_vda.h"
++#include "../lib/str_replace.h" // for strlcpy
++#include "../lib/str_util.h"
  
-+static const size_t chunk_dirs_size=256;
-+
- // get the path to the chunk's directory
+ using std::map;
+ using std::string;
+@@ -52,7 +54,7 @@
  //
  static void get_chunk_dir(DB_VDA_FILE& vf, const char* chunk_name, char* dir) {
--    char chunk_dirs[256];
+     char chunk_dirs[256];
 -    strcpy(chunk_dirs, chunk_name);
-+    char chunk_dirs[chunk_dirs_size];
-+    strlcpy(chunk_dirs, chunk_name, chunk_dirs_size);
++    safe_strcpy(chunk_dirs, chunk_name);
      while (1) {
          char* p = strchr(chunk_dirs, '.');
          if (!p) break;
@@ -23,16 +25,76 @@ Index: boinc/vda/sched_vda.cpp
  static void get_chunk_url(DB_VDA_FILE& vf, const char* chunk_name, char* url) {
      char chunk_dirs[256];
 -    strcpy(chunk_dirs, chunk_name);
-+    strlcpy(chunk_dirs, chunk_name, chunk_dirs_size);
++    safe_strcpy(chunk_dirs, chunk_name);
      while (1) {
          char* p = strchr(chunk_dirs, '.');
          if (!p) break;
-@@ -74,7 +76,7 @@
+@@ -74,9 +76,10 @@
  
  // read the chunk's MD5 file into a buffer
  //
 -static int get_chunk_md5(char* chunk_dir, char* md5_buf) {
 +static int get_chunk_md5(const char* chunk_dir, char* md5_buf) {
      char md5_path[1024];
-     sprintf(md5_path, "%s/md5.txt", chunk_dir);
+-    sprintf(md5_path, "%s/md5.txt", chunk_dir);
++    safe_strcpy(md5_path,chunk_dir);
++    safe_strcat(md5_path,"/md5.txt");
      FILE* f = fopen(md5_path, "r");
+     if (!f) return ERR_FOPEN;
+     char* p = fgets(md5_buf, 64, f);
+@@ -95,15 +98,20 @@
+ // else
+ //      delete from upload dir
+ //
+-static int process_completed_upload(char* chunk_name, CHUNK_LIST& chunks) {
++static int process_completed_upload(const char* chunk_name, CHUNK_LIST& chunks) {
+     char path[1024], client_filename[1024], dir[1024];
+     int retval;
+ 
+-    sprintf(client_filename, "%d_%s", g_reply->host.id, chunk_name);
++    sprintf(client_filename, "%d_", g_reply->host.id);
++    safe_strcat(client_filename, chunk_name);
+     dir_hier_path(
+         client_filename, config.upload_dir, config.uldl_dir_fanout, dir, false
+     );
+-    sprintf(path, "%s/%s", dir, client_filename);
++
++    safe_strcpy(path,dir);
++    safe_strcat(path,"/");
++    safe_strcat(path,client_filename);
++
+     CHUNK_LIST::iterator i2 = chunks.find(string(chunk_name));
+     if (i2 == chunks.end()) {
+         if (config.debug_vda) {
+@@ -209,7 +217,7 @@
+ // issue upload and download commands
+ //
+ static int issue_transfer_commands(CHUNK_LIST& chunks) {
+-    char xml_buf[8192], file_name[1024];
++    char xml_buf[8192], file_name[2048];
+     int retval;
+     char url[1024];
+ 
+@@ -230,7 +238,10 @@
+             }
+             // upload
+             //
+-            sprintf(file_name, "%d_%s__%s", g_reply->host.id, ch.name, vf.name);
++            sprintf(file_name, "%d_", g_reply->host.id);
++            safe_strcat(file_name, ch.name);
++            safe_strcat(file_name, "__");
++            safe_strcat(file_name, vf.name);
+             urls.push_back(config.upload_url);
+             R_RSA_PRIVATE_KEY key;
+             retval = get_file_xml(
+@@ -251,7 +262,9 @@
+             // download
+             //
+             char md5[64], chunk_dir[1024];
+-            sprintf(file_name, "%s__%s", ch.name, vf.name);
++            safe_strcpy(file_name, ch.name);
++            safe_strcat(file_name, "__");
++            safe_strcat(file_name, vf.name);
+             get_chunk_url(vf, ch.name, url);
+             urls.push_back(url);
+             get_chunk_dir(vf, ch.name, chunk_dir);
diff --git a/debian/patches/series b/debian/patches/series
index 195098b..37ef489 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -22,3 +22,5 @@ redundant_i.patch
 cppcheck_realloc.patch
 cwd_handling.patch
 sched_vda_strncpy.patch
+parse_issues.patch
+client_stream_realloc.patch

-- 
BOINC packaging



More information about the pkg-boinc-commits mailing list