Merge pull request #4862 from computezrmle/patch-1

Increase msg_buf size
This commit is contained in:
Vitalii Koshura 2022-08-01 19:52:20 +02:00 committed by GitHub
commit 40548c5dd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 12 deletions

View File

@ -185,7 +185,7 @@ static int lookup_group(const char* name, gid_t& gid) {
#endif
int remove_project_owned_file_or_dir(const char* path) {
char cmd[1024];
char cmd[5120];
if (g_use_sandbox) {
snprintf(cmd, sizeof(cmd), "/bin/rm rm -fR \"%s\"", path);

View File

@ -413,14 +413,14 @@ int RPC::parse_reply() {
// If present, it chdirs to that directory.
int read_gui_rpc_password(char* buf, string& msg) {
char msg_buf[1024];
char msg_buf[5120];
FILE* f = fopen(GUI_RPC_PASSWD_FILE, "r");
if (!f) {
#if defined(__linux__)
#define HELP_URL "https://boinc.berkeley.edu/gui_rpc.php"
char path[MAXPATHLEN];
if (errno == EACCES) {
sprintf(msg_buf,
snprintf(msg_buf, sizeof(msg_buf),
"%s exists but can't be read. See %s",
GUI_RPC_PASSWD_FILE, HELP_URL
);
@ -442,16 +442,16 @@ int read_gui_rpc_password(char* buf, string& msg) {
fclose(g);
if (p) {
p += strlen("data_dir=");
sprintf(path, "%s/%s", p, GUI_RPC_PASSWD_FILE);
snprintf(path, sizeof(path), "%s/%s", p, GUI_RPC_PASSWD_FILE);
f = fopen(path, "r");
if (!f) {
if (errno == EACCES) {
sprintf(msg_buf,
snprintf(msg_buf, sizeof(msg_buf),
"%s exists but can't be read. See %s",
path, HELP_URL
);
} else {
sprintf(msg_buf, "%s not found. See %s",
snprintf(msg_buf, sizeof(msg_buf), "%s not found. See %s",
path, HELP_URL
);
}
@ -459,7 +459,7 @@ int read_gui_rpc_password(char* buf, string& msg) {
return ERR_FOPEN;
}
} else {
sprintf(msg_buf,
snprintf(msg_buf, sizeof(msg_buf),
"No data_dir= found in %s. See %s",
LINUX_CONFIG_FILE, HELP_URL
);
@ -469,18 +469,18 @@ int read_gui_rpc_password(char* buf, string& msg) {
} else {
// no config file; look in default data dir
//
sprintf(path, "%s/%s", LINUX_DEFAULT_DATA_DIR, GUI_RPC_PASSWD_FILE);
snprintf(path, sizeof(path), "%s/%s", LINUX_DEFAULT_DATA_DIR, GUI_RPC_PASSWD_FILE);
f = fopen(path, "r");
if (!f) {
if (errno == EACCES) {
sprintf(msg_buf,
snprintf(msg_buf, sizeof(msg_buf),
"%s exists but can't be read. See %s",
path, HELP_URL
);
msg = msg_buf;
return ERR_FOPEN;
}
sprintf(msg_buf, "%s not found. See %s",
snprintf(msg_buf, sizeof(msg_buf), "%s not found. See %s",
GUI_RPC_PASSWD_FILE, HELP_URL
);
msg = msg_buf;
@ -491,12 +491,12 @@ int read_gui_rpc_password(char* buf, string& msg) {
// non-Linux
if (errno == EACCES) {
sprintf(msg_buf,
snprintf(msg_buf, sizeof(msg_buf),
"%s exists but can't be read. Make sure your account is in the 'boinc_users' group",
GUI_RPC_PASSWD_FILE
);
} else {
sprintf(msg_buf, "%s not found. Try reinstalling BOINC.",
snprintf(msg_buf, sizeof(msg_buf), "%s not found. Try reinstalling BOINC.",
GUI_RPC_PASSWD_FILE
);
}