This commit is contained in:
Damien Stuart 2011-09-10 11:30:09 -04:00
commit f693a2721c
7 changed files with 17 additions and 9 deletions

View File

@ -768,7 +768,7 @@ config_init(fko_cli_options_t *options, int argc, char **argv)
fprintf(stderr, "Memory allocation error for resolve URL.\n");
exit(EXIT_FAILURE);
}
strcpy(options->resolve_url, optarg);
strlcpy(options->resolve_url, optarg, strlen(optarg)+1);
break;
case SHOW_LAST_ARGS:
options->show_last_command = 1;

View File

@ -604,7 +604,7 @@ run_last_args(fko_cli_options_t *options)
fprintf(stderr, "malloc failure for cmd line arg.\n");
exit(EXIT_FAILURE);
}
strcpy(argv_new[argc_new], arg_tmp);
strlcpy(argv_new[argc_new], arg_tmp, strlen(arg_tmp)+1);
current_arg_ctr = 0;
argc_new++;
}

View File

@ -93,7 +93,7 @@ parse_url(char *res_url, struct url* url)
}
else
{
strcpy(url->port, "80");
strlcpy(url->port, "80", 3);
tlen_offset = 0;
}

View File

@ -101,7 +101,7 @@ fko_encode_spa_data(fko_ctx_t ctx)
/* Put it together a piece at a time, starting with the rand val.
*/
strcpy(tbuf, ctx->rand_val);
strlcpy(tbuf, ctx->rand_val, FKO_ENCODE_TMP_BUF_SIZE);
/* Add the base64-encoded username.
*/

View File

@ -256,7 +256,7 @@ main(int argc, char **argv)
log_msg(LOG_WARNING,
"Error opening digest cache file. Incoming digests will not be remembered."
);
strcpy(opts.config[CONF_ENABLE_DIGEST_PERSISTENCE], "N");
strlcpy(opts.config[CONF_ENABLE_DIGEST_PERSISTENCE], "N", 2);
}
if(opts.verbose)
@ -405,7 +405,7 @@ check_dir_path(const char *filepath, const char *fp_desc, unsigned char use_base
if(use_basename && ((ndx = strrchr(filepath, PATH_SEP)) != NULL))
strlcpy(tmp_path, filepath, (ndx-filepath)+1);
else
strcpy(tmp_path, filepath);
strlcpy(tmp_path, filepath, MAX_PATH_LEN);
/* At this point, we should make the path is more than just the
* PATH_SEP. If it is not, silently return.

View File

@ -30,6 +30,7 @@
*****************************************************************************
*/
#include "fwknopd_common.h"
#include "utils.h"
#include "log_msg.h"
/* The default log facility (can be overridden via config file directive).
@ -60,6 +61,7 @@ free_logging(void)
void
init_logging(fko_srv_options_t *opts) {
char *my_name = NULL;
int is_syslog = 0;
/* In case this is a re-init.
*/
@ -74,6 +76,7 @@ init_logging(fko_srv_options_t *opts) {
{
my_name = opts->config[CONF_SYSLOG_IDENTITY];
log_name = malloc(strlen(opts->config[CONF_SYSLOG_IDENTITY])+1);
is_syslog = 1;
}
else
{
@ -89,7 +92,10 @@ init_logging(fko_srv_options_t *opts) {
/* Set our name.
*/
strcpy(log_name, my_name);
if (is_syslog)
strlcpy(log_name, my_name, strlen(opts->config[CONF_SYSLOG_IDENTITY])+1);
else
strlcpy(log_name, my_name, strlen(MY_NAME)+1);
/* If we are running in the foreground, all logging will go to stderr.
*/

View File

@ -105,9 +105,11 @@ rotate_digest_cache_file(fko_srv_options_t *opts)
/* The new filename is just the original with a trailing '-old'.
*/
#if USE_FILE_CACHE
strcpy(new_file, opts->config[CONF_DIGEST_FILE]);
strlcpy(new_file, opts->config[CONF_DIGEST_FILE],
strlen(opts->config[CONF_DIGEST_FILE])+5);
#else
strcpy(new_file, opts->config[CONF_DIGEST_DB_FILE]);
strlcpy(new_file, opts->config[CONF_DIGEST_DB_FILE],
strlen(opts->config[CONF_DIGEST_DB_FILE])+5);
#endif
strcat(new_file, "-old");