@@ -413,14 +413,14 @@ int RPC::parse_reply() {
413
413
// If present, it chdirs to that directory.
414
414
415
415
int read_gui_rpc_password (char * buf, string& msg) {
416
- char msg_buf[1024 ];
416
+ char msg_buf[5120 ];
417
417
FILE* f = fopen (GUI_RPC_PASSWD_FILE, " r" );
418
418
if (!f) {
419
419
#if defined(__linux__)
420
420
#define HELP_URL " https://boinc.berkeley.edu/gui_rpc.php"
421
421
char path[MAXPATHLEN];
422
422
if (errno == EACCES) {
423
- sprintf (msg_buf,
423
+ snprintf (msg_buf, sizeof (msg_buf) ,
424
424
" %s exists but can't be read. See %s" ,
425
425
GUI_RPC_PASSWD_FILE, HELP_URL
426
426
);
@@ -442,24 +442,24 @@ int read_gui_rpc_password(char* buf, string& msg) {
442
442
fclose (g);
443
443
if (p) {
444
444
p += strlen (" data_dir=" );
445
- sprintf (path, " %s/%s" , p, GUI_RPC_PASSWD_FILE);
445
+ snprintf (path, sizeof (path) , " %s/%s" , p, GUI_RPC_PASSWD_FILE);
446
446
f = fopen (path, " r" );
447
447
if (!f) {
448
448
if (errno == EACCES) {
449
- sprintf (msg_buf,
449
+ snprintf (msg_buf, sizeof (msg_buf) ,
450
450
" %s exists but can't be read. See %s" ,
451
451
path, HELP_URL
452
452
);
453
453
} else {
454
- sprintf (msg_buf, " %s not found. See %s" ,
454
+ snprintf (msg_buf, sizeof (msg_buf) , " %s not found. See %s" ,
455
455
path, HELP_URL
456
456
);
457
457
}
458
458
msg = msg_buf;
459
459
return ERR_FOPEN;
460
460
}
461
461
} else {
462
- sprintf (msg_buf,
462
+ snprintf (msg_buf, sizeof (msg_buf) ,
463
463
" No data_dir= found in %s. See %s" ,
464
464
LINUX_CONFIG_FILE, HELP_URL
465
465
);
@@ -469,18 +469,18 @@ int read_gui_rpc_password(char* buf, string& msg) {
469
469
} else {
470
470
// no config file; look in default data dir
471
471
//
472
- sprintf (path, " %s/%s" , LINUX_DEFAULT_DATA_DIR, GUI_RPC_PASSWD_FILE);
472
+ snprintf (path, sizeof (path) , " %s/%s" , LINUX_DEFAULT_DATA_DIR, GUI_RPC_PASSWD_FILE);
473
473
f = fopen (path, " r" );
474
474
if (!f) {
475
475
if (errno == EACCES) {
476
- sprintf (msg_buf,
476
+ snprintf (msg_buf, sizeof (msg_buf) ,
477
477
" %s exists but can't be read. See %s" ,
478
478
path, HELP_URL
479
479
);
480
480
msg = msg_buf;
481
481
return ERR_FOPEN;
482
482
}
483
- sprintf (msg_buf, " %s not found. See %s" ,
483
+ snprintf (msg_buf, sizeof (msg_buf) , " %s not found. See %s" ,
484
484
GUI_RPC_PASSWD_FILE, HELP_URL
485
485
);
486
486
msg = msg_buf;
@@ -491,12 +491,12 @@ int read_gui_rpc_password(char* buf, string& msg) {
491
491
// non-Linux
492
492
493
493
if (errno == EACCES) {
494
- sprintf (msg_buf,
494
+ snprintf (msg_buf, sizeof (msg_buf) ,
495
495
" %s exists but can't be read. Make sure your account is in the 'boinc_users' group" ,
496
496
GUI_RPC_PASSWD_FILE
497
497
);
498
498
} else {
499
- sprintf (msg_buf, " %s not found. Try reinstalling BOINC." ,
499
+ snprintf (msg_buf, sizeof (msg_buf) , " %s not found. Try reinstalling BOINC." ,
500
500
GUI_RPC_PASSWD_FILE
501
501
);
502
502
}
0 commit comments