(Franck Joncourt) patch to address sprintf() warnings for issue #60

This commit is contained in:
Michael Rash 2013-05-04 14:16:06 -04:00
parent 5804e15859
commit 3c3283992c
2 changed files with 4 additions and 2 deletions

View File

@ -249,7 +249,7 @@ parse_url(char *res_url, struct url* url)
return(-1);
}
sprintf(url->port, "%u", port);
snprintf(url->port, sizeof(url->port)-1, "%u", port);
/* Get the offset we need to skip the port portion when we
* extract the hostname part.
@ -308,6 +308,8 @@ resolve_ip_http(fko_cli_options_t *options)
int res;
struct url url;
memset(&url, 0, sizeof(url));
if(options->resolve_url != NULL)
{
if(parse_url(options->resolve_url, &url) < 0)

View File

@ -185,7 +185,7 @@ jump_rule_exists(const int chain_num)
char line_buf[CMD_BUFSIZE] = {0};
FILE *ipt;
sprintf(cmd_buf, "%s " IPT_LIST_RULES_ARGS,
snprintf(cmd_buf, CMD_BUFSIZE-1, "%s " IPT_LIST_RULES_ARGS,
fwc.fw_command,
fwc.chain[chain_num].table,
fwc.chain[chain_num].from_chain