diff --git a/api/boinc_api.cpp b/api/boinc_api.cpp index e53749bc851..c9d301923b5 100644 --- a/api/boinc_api.cpp +++ b/api/boinc_api.cpp @@ -849,7 +849,7 @@ int resume_activities() { } static void handle_upload_file_status() { - char path[256], buf[256], log_name[256], *p, log_buf[256]; + char path[MAXPATHLEN], buf[256], log_name[256], *p, log_buf[256]; std::string filename; int status; @@ -1000,7 +1000,7 @@ struct GRAPHICS_APP { void run(char* path) { int argc; char* argv[4]; - char abspath[1024]; + char abspath[MAXPATHLEN]; #ifdef _WIN32 GetFullPathName(path, 1024, abspath, NULL); #else @@ -1039,7 +1039,7 @@ static bool have_graphics_app; // The following is for backwards compatibility with version 5 clients. // static inline void handle_graphics_messages() { - static char graphics_app_path[1024]; + static char graphics_app_path[MAXPATHLEN]; char buf[MSG_CHANNEL_SIZE]; GRAPHICS_MSG m; static bool first=true; @@ -1389,7 +1389,7 @@ int boinc_fraction_done(double x) { int boinc_receive_trickle_down(char* buf, int len) { std::string filename; - char path[256]; + char path[MAXPATHLEN]; if (!options.handle_trickle_downs) return false; diff --git a/checkin_notes b/checkin_notes index 0b51371a5ff..c47f2a3c8db 100644 --- a/checkin_notes +++ b/checkin_notes @@ -3750,4 +3750,7 @@ Bernd 9 May 2012 boinc_db.cpp +David 9 May 2012 + - C++ code: use MAXPATHLEN for char arrays that hold paths + (many .cpp files) diff --git a/client/app.cpp b/client/app.cpp index de2a20f0a5b..fae19c590c0 100644 --- a/client/app.cpp +++ b/client/app.cpp @@ -413,7 +413,7 @@ void ACTIVE_TASK_SET::get_memory_usage() { // Move it from slot dir to project dir // int ACTIVE_TASK::move_trickle_file() { - char project_dir[256], new_path[1024], old_path[1024]; + char project_dir[256], new_path[MAXPATHLEN], old_path[MAXPATHLEN]; int retval; get_project_dir(result->project, project_dir, sizeof(project_dir)); @@ -440,7 +440,7 @@ int ACTIVE_TASK::current_disk_usage(double& size) { unsigned int i; int retval; FILE_INFO* fip; - char path[1024]; + char path[MAXPATHLEN]; retval = dir_size(slot_dir, size); if (retval) return retval; @@ -464,7 +464,7 @@ bool ACTIVE_TASK_SET::is_slot_in_use(int slot) { } bool ACTIVE_TASK_SET::is_slot_dir_in_use(char* dir) { - char path[1024]; + char path[MAXPATHLEN]; unsigned int i; for (i=0; islot, path, sizeof(path)); @@ -479,7 +479,7 @@ bool ACTIVE_TASK_SET::is_slot_dir_in_use(char* dir) { void ACTIVE_TASK::get_free_slot(RESULT* rp) { #ifndef SIM int j, retval; - char path[1024]; + char path[MAXPATHLEN]; for (j=0; ; j++) { if (gstate.active_tasks.is_slot_in_use(j)) continue; @@ -886,7 +886,7 @@ void ACTIVE_TASK_SET::report_overdue() { // int ACTIVE_TASK::handle_upload_files() { std::string filename; - char buf[256], path[1024]; + char buf[256], path[MAXPATHLEN]; int retval; DirScanner dirscan(slot_dir); @@ -942,7 +942,7 @@ void ACTIVE_TASK_SET::network_available() { } void ACTIVE_TASK::upload_notify_app(const FILE_INFO* fip, const FILE_REF* frp) { - char path[256]; + char path[MAXPATHLEN]; sprintf(path, "%s/%s%s", slot_dir, UPLOAD_FILE_STATUS_PREFIX, frp->open_name); FILE* f = boinc_fopen(path, "w"); if (!f) return; diff --git a/client/app_control.cpp b/client/app_control.cpp index f67a31f9395..d2505598aa6 100644 --- a/client/app_control.cpp +++ b/client/app_control.cpp @@ -529,13 +529,13 @@ void ACTIVE_TASK::handle_exited_app(int stat) { } bool ACTIVE_TASK::finish_file_present() { - char path[256]; + char path[MAXPATHLEN]; sprintf(path, "%s/%s", slot_dir, BOINC_FINISH_CALLED_FILE); return (boinc_file_exists(path) != 0); } bool ACTIVE_TASK::temporary_exit_file_present(double& x, char* buf) { - char path[256]; + char path[MAXPATHLEN]; sprintf(path, "%s/%s", slot_dir, TEMPORARY_EXIT_FILE); FILE* f = fopen(path, "r"); if (!f) return false; @@ -805,7 +805,7 @@ int ACTIVE_TASK::abort_task(int exit_status, const char* msg) { // int ACTIVE_TASK::read_stderr_file() { char* buf1, *buf2; - char path[256]; + char path[MAXPATHLEN]; // truncate stderr output to the last 63KB; // it's unlikely that more than that will be useful @@ -1341,7 +1341,7 @@ void ACTIVE_TASK_SET::get_msgs() { // (this avoids rewriting the state file on each checkpoint) // void ACTIVE_TASK::write_task_state_file() { - char path[1024]; + char path[MAXPATHLEN]; sprintf(path, "%s/%s", slot_dir, TASK_STATE_FILENAME); FILE* f = fopen(path, "w"); if (!f) return; @@ -1366,7 +1366,7 @@ void ACTIVE_TASK::write_task_state_file() { // then the main state file // void ACTIVE_TASK::read_task_state_file() { - char buf[4096], path[1024], s[1024]; + char buf[4096], path[MAXPATHLEN], s[1024]; sprintf(path, "%s/%s", slot_dir, TASK_STATE_FILENAME); FILE* f = fopen(path, "r"); if (!f) return; diff --git a/client/app_start.cpp b/client/app_start.cpp index c8b69e99794..f91169bc28c 100644 --- a/client/app_start.cpp +++ b/client/app_start.cpp @@ -160,7 +160,7 @@ int ACTIVE_TASK::get_shmem_seg_name() { if (!shm_handle) return ERR_SHMGET; sprintf(shmem_seg_name, "boinc_%d", i); #else - char init_data_path[256]; + char init_data_path[MAXPATHLEN]; #ifndef __EMX__ // shmem_seg_name is not used with mmap() shared memory if (app_version->api_major_version() >= 6) { @@ -195,7 +195,7 @@ int ACTIVE_TASK::get_shmem_seg_name() { } void ACTIVE_TASK::init_app_init_data(APP_INIT_DATA& aid) { - char project_dir[256], project_path[256]; + char project_dir[256], project_path[MAXPATHLEN]; aid.major_version = BOINC_MAJOR_VERSION; aid.minor_version = BOINC_MINOR_VERSION; @@ -279,7 +279,7 @@ void ACTIVE_TASK::init_app_init_data(APP_INIT_DATA& aid) { // int ACTIVE_TASK::write_app_init_file(APP_INIT_DATA& aid) { FILE *f; - char init_data_path[256]; + char init_data_path[MAXPATHLEN]; sprintf(init_data_path, "%s/%s", slot_dir, INIT_DATA_FILE); @@ -308,7 +308,7 @@ static int create_dirs_for_logical_name( const char* name, const char* slot_dir ) { char buf[1024]; - char dir_path[1024]; + char dir_path[MAXPATHLEN]; int retval; strcpy(buf, name); @@ -353,7 +353,7 @@ bool ACTIVE_TASK::must_copy_file(FILE_REF& fref, bool is_io_file) { int ACTIVE_TASK::setup_file( FILE_INFO* fip, FILE_REF& fref, char* file_path, bool input, bool is_io_file ) { - char link_path[256], rel_file_path[256], open_name[256]; + char link_path[MAXPATHLEN], rel_file_path[MAXPATHLEN], open_name[256]; int retval; PROJECT* project = result->project; @@ -426,7 +426,7 @@ int ACTIVE_TASK::link_user_files() { unsigned int i; FILE_REF fref; FILE_INFO* fip; - char file_path[1024]; + char file_path[MAXPATHLEN]; for (i=0; iuser_files.size(); i++) { fref = project->user_files[i]; @@ -481,7 +481,7 @@ int ACTIVE_TASK::copy_output_files() { // ACTIVE_TASK::task_state is PROCESS_EXECUTING // int ACTIVE_TASK::start() { - char exec_name[256], file_path[256], buf[256], exec_path[256]; + char exec_name[256], file_path[MAXPATHLEN], buf[256], exec_path[MAXPATHLEN]; char cmdline[80000]; // 64KB plus some extra unsigned int i; FILE_REF fref; @@ -628,7 +628,7 @@ int ACTIVE_TASK::start() { PROCESS_INFORMATION process_info; STARTUPINFO startup_info; LPVOID environment_block = NULL; - char slotdirpath[256]; + char slotdirpath[MAXPATHLEN]; char error_msg[1024]; char error_msg2[1024]; @@ -1004,7 +1004,7 @@ int ACTIVE_TASK::start() { } sprintf(buf, "../../%s", exec_path); if (g_use_sandbox) { - char switcher_path[100]; + char switcher_path[MAXPATHLEN]; sprintf(switcher_path, "../../%s/%s", SWITCHER_DIR, SWITCHER_FILE_NAME ); diff --git a/client/async_file.h b/client/async_file.h index f3c2a5ee093..bdc14949172 100644 --- a/client/async_file.h +++ b/client/async_file.h @@ -44,7 +44,7 @@ struct ASYNC_COPY { ACTIVE_TASK* atp; FILE_INFO* fip; FILE* in, *out; - char to_path[1024], temp_path[1024]; + char to_path[MAXPATHLEN], temp_path[MAXPATHLEN]; ASYNC_COPY(); ~ASYNC_COPY(); @@ -65,7 +65,7 @@ struct ASYNC_VERIFY { md5_state_t md5_state; FILE* in, *out; gzFile gzin; - char inpath[1024], temp_path[1024], outpath[1024]; + char inpath[MAXPATHLEN], temp_path[MAXPATHLEN], outpath[MAXPATHLEN]; ASYNC_VERIFY(){}; ~ASYNC_VERIFY(){}; diff --git a/client/client_state.cpp b/client/client_state.cpp index 74d4ff94408..d8d80cc0477 100644 --- a/client/client_state.cpp +++ b/client/client_state.cpp @@ -1059,7 +1059,7 @@ int CLIENT_STATE::link_app_version(PROJECT* p, APP_VERSION* avp) { } if (!strcmp(file_ref.open_name, GRAPHICS_APP_FILENAME)) { - char relpath[512], path[512]; + char relpath[MAXPATHLEN], path[MAXPATHLEN]; get_pathname(fip, relpath, sizeof(relpath)); relative_to_absolute(relpath, path); strlcpy(avp->graphics_exec_path, path, sizeof(avp->graphics_exec_path)); @@ -1831,7 +1831,7 @@ int CLIENT_STATE::detach_project(PROJECT* project) { vector::iterator fi_iter; FILE_INFO* fip; PROJECT* p; - char path[256]; + char path[MAXPATHLEN]; int retval; reset_project(project, true); diff --git a/client/client_types.cpp b/client/client_types.cpp index db35f0a7592..d96a4b6a5af 100644 --- a/client/client_types.cpp +++ b/client/client_types.cpp @@ -511,7 +511,7 @@ int FILE_INFO::write_gui(MIOFILE& out) { // delete physical underlying file associated with FILE_INFO // int FILE_INFO::delete_file() { - char path[1024]; + char path[MAXPATHLEN]; get_pathname(this, path, sizeof(path)); int retval = delete_project_owned_file(path, true); @@ -653,7 +653,7 @@ void FILE_INFO::failure_message(string& s) { #define BUFSIZE 16384 int FILE_INFO::gzip() { char buf[BUFSIZE]; - char inpath[1024], outpath[1024]; + char inpath[MAXPATHLEN], outpath[MAXPATHLEN]; get_pathname(this, inpath, sizeof(inpath)); strcpy(outpath, inpath); @@ -682,7 +682,7 @@ int FILE_INFO::gzip() { // int FILE_INFO::gunzip(char* md5_buf) { unsigned char buf[BUFSIZE]; - char inpath[1024], outpath[1024], tmppath[1024]; + char inpath[MAXPATHLEN], outpath[MAXPATHLEN], tmppath[MAXPATHLEN]; md5_state_t md5_state; md5_init(&md5_state); diff --git a/client/client_types.h b/client/client_types.h index 262b8534591..0832e264281 100644 --- a/client/client_types.h +++ b/client/client_types.h @@ -28,6 +28,7 @@ #if !defined(_WIN32) || defined(__CYGWIN32__) #include #include +#include #endif #include "md5_file.h" @@ -294,7 +295,7 @@ struct APP_VERSION { PROJECT* project; std::vector app_files; int ref_cnt; - char graphics_exec_path[512]; + char graphics_exec_path[MAXPATHLEN]; char graphics_exec_file[256]; double max_working_set_size; // max working set of tasks using this app version. diff --git a/client/cs_account.cpp b/client/cs_account.cpp index 1d1a16083aa..7eb6c29050e 100644 --- a/client/cs_account.cpp +++ b/client/cs_account.cpp @@ -55,7 +55,7 @@ using std::sort; // (which normally is undefined) is valid // int PROJECT::write_account_file() { - char path[256]; + char path[MAXPATHLEN]; FILE* f; int retval; @@ -183,7 +183,7 @@ int PROJECT::parse_account(FILE* in) { // (so that we know the host venue) // int PROJECT::parse_account_file_venue() { - char attr_buf[256], venue[256], path[256], buf2[256]; + char attr_buf[256], venue[256], path[MAXPATHLEN], buf2[256]; int retval; bool in_right_venue = false, btemp; @@ -258,7 +258,7 @@ int PROJECT::parse_account_file_venue() { } int PROJECT::parse_account_file() { - char path[256]; + char path[MAXPATHLEN]; int retval; FILE* f; @@ -427,7 +427,7 @@ int CLIENT_STATE::parse_statistics_files() { } int PROJECT::write_statistics_file() { - char path[256]; + char path[MAXPATHLEN]; FILE* f; int retval; @@ -473,7 +473,7 @@ int CLIENT_STATE::add_project( const char* master_url, const char* _auth, const char* project_name, bool attached_via_acct_mgr ) { - char path[256], canonical_master_url[256], auth[256], dir[256]; + char path[MAXPATHLEN], canonical_master_url[256], auth[256], dir[256]; PROJECT* project; FILE* f; int retval; diff --git a/client/cs_apps.cpp b/client/cs_apps.cpp index 254772118e8..87588f28121 100644 --- a/client/cs_apps.cpp +++ b/client/cs_apps.cpp @@ -103,7 +103,7 @@ int CLIENT_STATE::app_finished(ACTIVE_TASK& at) { #ifndef SIM FILE_INFO* fip; unsigned int i; - char path[256]; + char path[MAXPATHLEN]; int retval; double size; diff --git a/client/cs_files.cpp b/client/cs_files.cpp index e6ed1eb0e8a..c9dcc5bf928 100644 --- a/client/cs_files.cpp +++ b/client/cs_files.cpp @@ -176,7 +176,7 @@ int FILE_INFO::verify_file( // see if we need to unzip it // if (download_gzipped && !boinc_file_exists(pathname)) { - char gzpath[256]; + char gzpath[MAXPATHLEN]; sprintf(gzpath, "%s.gz", pathname); if (boinc_file_exists(gzpath) ) { if (allow_async && nbytes > ASYNC_FILE_THRESHOLD) { @@ -401,7 +401,7 @@ bool CLIENT_STATE::create_and_delete_pers_file_xfers() { // If this was a compressed download, rename .gzt to .gz // if (fip->download_gzipped) { - char path[256], from_path[256], to_path[256]; + char path[MAXPATHLEN], from_path[MAXPATHLEN], to_path[MAXPATHLEN]; get_pathname(fip, path, sizeof(path)); sprintf(from_path, "%s.gzt", path); sprintf(to_path, "%s.gz", path); @@ -459,7 +459,7 @@ bool CLIENT_STATE::create_and_delete_pers_file_xfers() { // void CLIENT_STATE::check_file_existence() { unsigned int i; - char path[1024]; + char path[MAXPATHLEN]; for (i=0; iarchive_file_name(path); @@ -564,7 +564,7 @@ void RSS_FEED::archive_file_name(char* path) { // insert items in NOTICES // int RSS_FEED::read_archive_file() { - char path[256]; + char path[MAXPATHLEN]; archive_file_name(path); return notices.read_archive_file(path, this); } @@ -775,7 +775,7 @@ void RSS_FEED_OP::handle_reply(int http_op_retval) { static void init_proj_am(PROJ_AM* p) { FILE* f; MIOFILE fin; - char path[256]; + char path[MAXPATHLEN]; project_feed_list_file_name(p, path); f = fopen(path, "r"); diff --git a/client/cs_statefile.cpp b/client/cs_statefile.cpp index 27acfdfd8b6..64cfc13abfc 100644 --- a/client/cs_statefile.cpp +++ b/client/cs_statefile.cpp @@ -801,7 +801,7 @@ int CLIENT_STATE::write_state_file_if_needed() { // void CLIENT_STATE::check_anonymous() { unsigned int i; - char dir[256], path[256]; + char dir[256], path[MAXPATHLEN]; FILE* f; int retval; @@ -832,7 +832,7 @@ void CLIENT_STATE::check_anonymous() { // parse a project's app_info.xml (anonymous platform) file // int CLIENT_STATE::parse_app_info(PROJECT* p, FILE* in) { - char buf[256], path[1024]; + char buf[256], path[MAXPATHLEN]; MIOFILE mf; mf.init_file(in); XML_PARSER xp(&mf); diff --git a/client/cs_trickle.cpp b/client/cs_trickle.cpp index 006fb5fb1ff..ed516e5be7a 100644 --- a/client/cs_trickle.cpp +++ b/client/cs_trickle.cpp @@ -47,7 +47,7 @@ using std::string; // int CLIENT_STATE::read_trickle_files(PROJECT* project, FILE* f) { char project_dir[256], *p, *q, result_name[256], fname[256]; - char* file_contents, path[256], newpath[256]; + char* file_contents, path[MAXPATHLEN], newpath[MAXPATHLEN]; string fn; time_t t; int retval; @@ -99,7 +99,7 @@ int CLIENT_STATE::read_trickle_files(PROJECT* project, FILE* f) { // (others arrived from application while RPC was happening) // int CLIENT_STATE::remove_trickle_files(PROJECT* project) { - char project_dir[256], path[256], fname[256]; + char project_dir[256], path[MAXPATHLEN], fname[256]; string fn; get_project_dir(project, project_dir, sizeof(project_dir)); @@ -122,7 +122,7 @@ int CLIENT_STATE::remove_trickle_files(PROJECT* project) { // int CLIENT_STATE::handle_trickle_down(PROJECT* project, FILE* in) { char buf[256]; - char result_name[256], path[256]; + char result_name[256], path[MAXPATHLEN]; string body; int send_time=0; diff --git a/client/file_names.cpp b/client/file_names.cpp index 7138166d07b..728f5c5c53e 100644 --- a/client/file_names.cpp +++ b/client/file_names.cpp @@ -230,7 +230,7 @@ int make_slot_dir(int slot) { // delete unused stuff in the slots/ directory // void delete_old_slot_dirs() { - char filename[1024], path[1024]; + char filename[1024], path[MAXPATHLEN]; DIRREF dirp; int retval; @@ -243,7 +243,7 @@ void delete_old_slot_dirs() { snprintf(path, sizeof(path), "%s/%s", SLOTS_DIR, filename); if (is_dir(path)) { #ifndef _WIN32 - char init_data_path[1024]; + char init_data_path[MAXPATHLEN]; SHMEM_SEG_NAME shmem_seg_name; // If BOINC crashes or exits suddenly (e.g., due to diff --git a/client/gui_rpc_server_ops.cpp b/client/gui_rpc_server_ops.cpp index 383f8f9ff51..46d955f3215 100644 --- a/client/gui_rpc_server_ops.cpp +++ b/client/gui_rpc_server_ops.cpp @@ -146,7 +146,7 @@ static void handle_get_disk_usage(GUI_RPC_CONN& grc) { // If launched by Manager, get Manager's size on disk ProcessSerialNumber managerPSN; FSRef ourFSRef; - char path[1024]; + char path[MAXPATHLEN]; double manager_size = 0.0; OSStatus err; err = GetProcessForPID(getppid(), &managerPSN); diff --git a/client/log_flags.cpp b/client/log_flags.cpp index f2a1a259571..ceab783f05d 100644 --- a/client/log_flags.cpp +++ b/client/log_flags.cpp @@ -232,7 +232,7 @@ void CONFIG::show() { // KEEP IN SYNCH WITH CONFIG::parse_options()!! int CONFIG::parse_options_client(XML_PARSER& xp) { - char path[256]; + char path[MAXPATHLEN]; string s; int n, retval; diff --git a/client/project.cpp b/client/project.cpp index 36ee4d64d3f..8058b8be3b3 100644 --- a/client/project.cpp +++ b/client/project.cpp @@ -616,7 +616,7 @@ const char* PROJECT::get_scheduler_url(int index, double r) { // void PROJECT::delete_project_file_symlinks() { unsigned int i; - char project_dir[256], path[256]; + char project_dir[256], path[MAXPATHLEN]; get_project_dir(this, project_dir, sizeof(project_dir)); for (i=0; i(util_filename); @@ -184,7 +184,7 @@ int delete_project_owned_file(const char* path, bool retry) { // If an error occurs, delete as much as possible. // int client_clean_out_dir(const char* dirpath, const char* reason) { - char filename[256], path[256]; + char filename[256], path[MAXPATHLEN]; int retval, final_retval = 0; DIRREF dirp; diff --git a/lib/crypt.cpp b/lib/crypt.cpp index a3ace20d68f..0057c6ff273 100644 --- a/lib/crypt.cpp +++ b/lib/crypt.cpp @@ -604,7 +604,7 @@ char *check_validity( char file[256]; while (dir_scan(file, dir, sizeof(file))) { - char fpath[512]; + char fpath[MAXPATHLEN]; snprintf(fpath, sizeof(fpath), "%s/%s", certPath, file); // TODO : replace '128' if (check_validity_of_cert(fpath, md5_md, signature, 128, caPath)) { @@ -624,7 +624,7 @@ int cert_verify_file( int rbytes; unsigned char md5_md[MD5_DIGEST_LENGTH], rbuf[2048]; char buf[256]; - char fbuf[512]; + char fbuf[MAXPATHLEN]; int verified = false; int file_counter = 0; DATA_BLOCK sig_db; @@ -657,7 +657,7 @@ int cert_verify_file( sscan_hex_data(signatures->signatures.at(i).signature, sig_db); file_counter = 0; while (1) { - snprintf(fbuf, 512, "%s/%s.%d", trustLocation, signatures->signatures.at(i).hash, + snprintf(fbuf, MAXPATHLEN, "%s/%s.%d", trustLocation, signatures->signatures.at(i).hash, file_counter); #ifndef _USING_FCGI_ FILE *f = fopen(fbuf, "r"); diff --git a/lib/filesys.cpp b/lib/filesys.cpp index 3e2548ad52d..eb07e7a370a 100644 --- a/lib/filesys.cpp +++ b/lib/filesys.cpp @@ -354,7 +354,7 @@ int boinc_truncate(const char* path, double size) { // remove everything from specified directory // int clean_out_dir(const char* dirpath) { - char filename[256], path[256]; + char filename[256], path[MAXPATHLEN]; int retval; DIRREF dirp; @@ -802,7 +802,7 @@ int get_filesystem_info(double &total_space, double &free_space, char* path) { #ifndef _WIN32 int get_file_dir(char* filename, char* dir) { - char buf[8192], *p, path[256]; + char buf[8192], *p, path[MAXPATHLEN]; struct stat sbuf; int retval; diff --git a/lib/gui_rpc_client.h b/lib/gui_rpc_client.h index c40249e694c..4900429580f 100644 --- a/lib/gui_rpc_client.h +++ b/lib/gui_rpc_client.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -274,10 +275,10 @@ struct RESULT { bool too_large; bool needs_shmem; bool edf_scheduled; - char graphics_exec_path[512]; + char graphics_exec_path[MAXPATHLEN]; char web_graphics_url[256]; char remote_desktop_addr[256]; - char slot_path[512]; + char slot_path[MAXPATHLEN]; // only present if graphics_exec_path is char resources[256]; diff --git a/lib/procinfo_unix.cpp b/lib/procinfo_unix.cpp index bc34f3966ce..9dff42b4bb2 100644 --- a/lib/procinfo_unix.cpp +++ b/lib/procinfo_unix.cpp @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -170,7 +171,7 @@ int procinfo_setup(PROC_MAP& pm) { FILE* fd; PROC_STAT ps; PROCINFO p; - char pidpath[1024]; + char pidpath[MAXPATHLEN]; char buf[1024]; int pid = getpid(); int retval, final_retval = 0; diff --git a/lib/util.cpp b/lib/util.cpp index dd858802b08..6afc319204b 100644 --- a/lib/util.cpp +++ b/lib/util.cpp @@ -516,7 +516,7 @@ static int get_client_mutex(const char*) { } #else static int get_client_mutex(const char* dir) { - char path[1024]; + char path[MAXPATHLEN]; static FILE_LOCK file_lock; sprintf(path, "%s/%s", dir, LOCK_FILE_NAME); diff --git a/sched/antique_file_deleter.cpp b/sched/antique_file_deleter.cpp index e1e785d0b12..db2dd69a8ae 100644 --- a/sched/antique_file_deleter.cpp +++ b/sched/antique_file_deleter.cpp @@ -116,7 +116,7 @@ int delete_antiques_from_dir(char*dirpath, time_t mtime, uid_t uid) { struct dirent*entry; struct stat fstat; int ret; - char path[2*256]; + char path[MAXPATHLEN]; // open directory errno = 0; diff --git a/sched/db_dump.cpp b/sched/db_dump.cpp index a0059a43bb8..49bdba93c2b 100644 --- a/sched/db_dump.cpp +++ b/sched/db_dump.cpp @@ -206,7 +206,7 @@ int DUMP_SPEC::parse(FILE* in) { class ZFILE { protected: string tag; // enclosing XML tag - char current_path[256]; + char current_path[MAXPATHLEN]; int compression; public: FILE* f; @@ -621,7 +621,7 @@ int ENUMERATION::make_it_happen(char* output_dir) { DB_TEAM team; DB_HOST host; char clause[256]; - char path[256]; + char path[MAXPATHLEN]; sprintf(path, "%s/%s", output_dir, filename); diff --git a/sched/feeder.cpp b/sched/feeder.cpp index 61bdbec906d..be1a804215e 100644 --- a/sched/feeder.cpp +++ b/sched/feeder.cpp @@ -101,6 +101,7 @@ #include #include #include +#include #include using std::vector; @@ -681,7 +682,7 @@ void usage(char *name) { int main(int argc, char** argv) { int i, retval; void* p; - char path[256]; + char path[MAXPATHLEN]; for (i=1; i #endif +#include #include #include #include @@ -122,7 +123,7 @@ int main(int argc, char** argv) { R_RSA_PRIVATE_KEY key; bool generate_upload_certificate = !config.dont_generate_upload_certificates; if (generate_upload_certificate) { - char keypath[256]; + char keypath[MAXPATHLEN]; sprintf(keypath, "%s/upload_private", config.key_dir); retval = read_key_file(keypath, key); if (retval) { diff --git a/sched/handle_request.cpp b/sched/handle_request.cpp index 91a640e8e59..c6b1860a14e 100644 --- a/sched/handle_request.cpp +++ b/sched/handle_request.cpp @@ -821,7 +821,7 @@ int handle_global_prefs() { bool send_code_sign_key(char* code_sign_key) { char* oldkey, *signature; int i, retval; - char path[256]; + char path[MAXPATHLEN]; if (strlen(g_request->code_sign_key)) { if (strcmp(g_request->code_sign_key, code_sign_key)) { diff --git a/sched/make_work.cpp b/sched/make_work.cpp index da7f95a20d8..9befb35842c 100644 --- a/sched/make_work.cpp +++ b/sched/make_work.cpp @@ -28,6 +28,7 @@ // #include "config.h" +#include #include #include #include @@ -172,7 +173,7 @@ void wait_for_results(int wu_id) { void make_work(vector &wu_names) { int retval, start_time=time(0); - char keypath[256]; + char keypath[MAXPATHLEN]; char buf[BLOB_SIZE]; R_RSA_PRIVATE_KEY key; int nwu_names = wu_names.size(); diff --git a/sched/put_file.cpp b/sched/put_file.cpp index 71995dc69a2..b715292f384 100644 --- a/sched/put_file.cpp +++ b/sched/put_file.cpp @@ -53,7 +53,7 @@ void usage() { int main(int argc, char** argv) { int i, retval; - char file_name[256], url[1024], path[1024]; + char file_name[256], url[1024], path[MAXPATHLEN]; int host_id; vector urls; double nbytes = -1; diff --git a/sched/sample_work_generator.cpp b/sched/sample_work_generator.cpp index fc2f7deedfa..da682526c7b 100644 --- a/sched/sample_work_generator.cpp +++ b/sched/sample_work_generator.cpp @@ -27,6 +27,7 @@ // the file (and the workunit names) contain a timestamp // and sequence number, so they're unique. +#include #include #include #include @@ -61,7 +62,7 @@ int seqno; // int make_job() { DB_WORKUNIT wu; - char name[256], path[256]; + char name[256], path[MAXPATHLEN]; const char* infiles[1]; int retval; diff --git a/sched/sched_assign.cpp b/sched/sched_assign.cpp index cd37ded1505..ec8dd571548 100644 --- a/sched/sched_assign.cpp +++ b/sched/sched_assign.cpp @@ -26,6 +26,7 @@ #include #endif +#include #include #include "boinc_db.h" @@ -46,7 +47,7 @@ static int send_assigned_job(ASSIGNMENT& asg) { int retval; DB_WORKUNIT wu; - char suffix[256], path[256]; + char suffix[256], path[MAXPATHLEN]; const char *rtfpath; static bool first=true; static int seqno=0; diff --git a/sched/sched_config.cpp b/sched/sched_config.cpp index c8e4675921c..ce8c3d8fd91 100644 --- a/sched/sched_config.cpp +++ b/sched/sched_config.cpp @@ -333,7 +333,7 @@ int SCHED_CONFIG::parse(FILE* f) { } int SCHED_CONFIG::parse_file(const char* dir) { - char path[256], path_aux[256]; + char path[MAXPATHLEN], path_aux[MAXPATHLEN]; int retval; if (dir && strlen(dir)) { @@ -390,7 +390,7 @@ static bool is_project_dir(const char* dir) { // specified by a format string + args // const char *SCHED_CONFIG::project_path(const char *fmt, ...) { - static char path[1024]; + static char path[MAXPATHLEN]; va_list ap; if (!strlen(project_dir)) { diff --git a/sched/sched_locality.cpp b/sched/sched_locality.cpp index 74d06353102..29e2be22658 100644 --- a/sched/sched_locality.cpp +++ b/sched/sched_locality.cpp @@ -212,7 +212,7 @@ bool host_has_file(char *filename, bool skip_last_wu) { // routine, in the same way as if there was no scheduling locality. // int decrement_disk_space_locality( WORKUNIT& wu) { - char filename[256], path[512]; + char filename[256], path[MAXPATHLEN]; int filesize; struct stat buf; diff --git a/sched/sched_main.cpp b/sched/sched_main.cpp index 2a2833653b4..77a1793df8d 100644 --- a/sched/sched_main.cpp +++ b/sched/sched_main.cpp @@ -286,7 +286,7 @@ void set_core_dump_size_limit() { #endif void attach_to_feeder_shmem() { - char path[256]; + char path[MAXPATHLEN]; strncpy(path, config.project_dir, sizeof(path)); get_key(path, 'a', sema_key); int i, retval; @@ -356,7 +356,7 @@ int main(int argc, char** argv) { FCGI_FILE *fin, *fout; #endif int i, retval; - char req_path[256], reply_path[256], log_path[256], path[256]; + char req_path[MAXPATHLEN], reply_path[MAXPATHLEN], log_path[MAXPATHLEN], path[MAXPATHLEN]; unsigned int counter=0; char* code_sign_key; int length=-1; diff --git a/sched/sched_timezone.cpp b/sched/sched_timezone.cpp index a3651c4064d..e7336450f2d 100644 --- a/sched/sched_timezone.cpp +++ b/sched/sched_timezone.cpp @@ -19,6 +19,7 @@ // download servers based on its time zone #include "config.h" +#include #include #include #include @@ -216,7 +217,7 @@ int add_download_servers(char *old_xml, char *new_xml, int tz) { // q is at beginning of next "" tag char *s; - char path[1024]; + char path[MAXPATHLEN]; int len = q-p; // copy everything from p to q to new_xml diff --git a/sched/sched_util.cpp b/sched/sched_util.cpp index b994544ae3f..6fe3fba459a 100644 --- a/sched/sched_util.cpp +++ b/sched/sched_util.cpp @@ -108,7 +108,7 @@ int try_fopen(const char* path, FCGI_FILE*& f, const char *mode) { #endif const char* p; DIR* d; - char dirpath[256]; + char dirpath[MAXPATHLEN]; #ifndef _USING_FCGI_ f = fopen(path, mode); @@ -163,7 +163,7 @@ int dir_hier_path( const char* filename, const char* root, int fanout, char* path, bool create ) { - char dir[256], dirpath[256]; + char dir[256], dirpath[MAXPATHLEN]; int retval; if (fanout==0) { diff --git a/sched/single_job_assimilator.cpp b/sched/single_job_assimilator.cpp index c4b35ae557f..be2da9fc009 100644 --- a/sched/single_job_assimilator.cpp +++ b/sched/single_job_assimilator.cpp @@ -97,7 +97,7 @@ int assimilate_handler( canonical_result.cpu_time ); vector output_files; - char copy_path[256]; + char copy_path[MAXPATHLEN]; get_output_file_infos(canonical_result, output_files); unsigned int n = output_files.size(); for (i=0; i #include #include +#include #include "boinc_db.h" #include "util.h" @@ -753,7 +754,7 @@ void usage(char *name) { int main(int argc, char** argv) { int i, retval; - char path[256]; + char path[MAXPATHLEN]; startup_time = time(0); for (i=1; i& fis) { - char path[1024]; + char path[MAXPATHLEN]; MIOFILE mf; string name; mf.init_buf_read(result.xml_doc_in); diff --git a/sched/wu_check.cpp b/sched/wu_check.cpp index ad2e3bee58c..7de20fe0ef2 100644 --- a/sched/wu_check.cpp +++ b/sched/wu_check.cpp @@ -23,6 +23,7 @@ // NOTE 2: should rewrite to enumerate WUs, not results #include "config.h" +#include #include #include #include @@ -57,7 +58,7 @@ int get_file_path(WORKUNIT& wu, char* path) { int handle_result(DB_RESULT& result) { DB_WORKUNIT wu; int retval; - char path[256]; + char path[MAXPATHLEN]; char buf[256]; FILE* f; diff --git a/tools/backend_lib.cpp b/tools/backend_lib.cpp index 598ffe78c5f..4f79c480217 100644 --- a/tools/backend_lib.cpp +++ b/tools/backend_lib.cpp @@ -203,7 +203,7 @@ int create_result( // int check_files(char** infiles, int ninfiles, SCHED_CONFIG& config_loc) { int i; - char path[256]; + char path[MAXPATHLEN]; for (i=0; i #include #include #include @@ -82,7 +83,7 @@ int main(int argc, const char** argv) { DB_WORKUNIT wu; int retval; char wu_template[BLOB_SIZE]; - char wu_template_file[256], result_template_file[256], result_template_path[1024]; + char wu_template_file[256], result_template_file[256], result_template_path[MAXPATHLEN]; const char* command_line=NULL; const char** infiles = NULL; int i, ninfiles; diff --git a/tools/dir_hier_move.cpp b/tools/dir_hier_move.cpp index 57411e72e04..c2d7bac3040 100644 --- a/tools/dir_hier_move.cpp +++ b/tools/dir_hier_move.cpp @@ -39,7 +39,7 @@ int main(int argc, char** argv) { char* src_dir, *dst_dir; int fanout=0; std::string filename; - char dst_path[256], src_path[256]; + char dst_path[MAXPATHLEN], src_path[MAXPATHLEN]; int retval; if ( (argc == 1) || !strcmp(argv[1], "-h") || !strcmp(argv[1],"--help") || (argc != 4) ) { diff --git a/tools/dir_hier_path.cpp b/tools/dir_hier_path.cpp index 29a2cb77571..97401a42010 100644 --- a/tools/dir_hier_path.cpp +++ b/tools/dir_hier_path.cpp @@ -23,6 +23,7 @@ #include "config.h" #include +#include #include "util.h" #include "sched_config.h" @@ -37,7 +38,7 @@ const char *usage = " and creates the directory if needed.\n\n"; int main(int argc, char** argv) { - char path[256]; + char path[MAXPATHLEN]; int retval; if ( (argc == 1) || !strcmp(argv[1], "-h") || !strcmp(argv[1],"--help") || (argc != 2) ) { diff --git a/tools/process_input_template.cpp b/tools/process_input_template.cpp index ab0006290de..427a7923218 100644 --- a/tools/process_input_template.cpp +++ b/tools/process_input_template.cpp @@ -143,7 +143,7 @@ static int process_file_info( int retval, file_number = -1; double nbytes, nbytesdef = -1; string md5str, urlstr, tmpstr; - char buf[BLOB_SIZE], path[256], top_download_path[256], md5[33], url[256]; + char buf[BLOB_SIZE], path[MAXPATHLEN], top_download_path[MAXPATHLEN], md5[33], url[256]; out += "\n"; while (!xp.get_tag()) { diff --git a/tools/updater.cpp b/tools/updater.cpp index 9efd513194c..a467e38baf8 100644 --- a/tools/updater.cpp +++ b/tools/updater.cpp @@ -78,7 +78,7 @@ int prepare_prev_dir() { } int move_file(const char* file, char* old_dir, char* new_dir) { - char old_path[1024], new_path[1024]; + char old_path[MAXPATHLEN], new_path[MAXPATHLEN]; sprintf(old_path, "%s/%s", old_dir, file); sprintf(new_path, "%s/%s", new_dir, file); int retval = boinc_rename(old_path, new_path); @@ -104,7 +104,7 @@ int move_files(vector files, char* old_dir, char* new_dir) { int main(int argc, char** argv) { int i, retval, argc2; - char filepath[512]; + char filepath[MAXPATHLEN]; #ifdef _WIN32 HANDLE core_pid, mgr_pid; #else