use switch_snprintf instead of snprintf becuase in insures null termination of strings.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6707 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris
2007-12-12 21:53:32 +00:00
parent 44636d333f
commit 54ec86f6ce
49 changed files with 306 additions and 306 deletions
+5 -5
View File
@@ -294,7 +294,7 @@ static switch_xml_t switch_xml_err(switch_xml_root_t root, char *s, const char *
for (t = root->s; t && t < s; t++)
if (*t == '\n')
line++;
snprintf(fmt, SWITCH_XML_ERRL, "[error near line %d]: %s", line, err);
switch_snprintf(fmt, SWITCH_XML_ERRL, "[error near line %d]: %s", line, err);
va_start(ap, err);
vsnprintf(root->err, SWITCH_XML_ERRL, fmt, ap);
@@ -1288,7 +1288,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_locate_domain(const char *domain_name
*domain = NULL;
if (!params) {
snprintf(my_params, sizeof(my_params), "domain=%s", domain_name);
switch_snprintf(my_params, sizeof(my_params), "domain=%s", domain_name);
params = my_params;
}
@@ -1312,10 +1312,10 @@ SWITCH_DECLARE(switch_status_t) switch_xml_locate_user(const char *key,
*domain = NULL;
if (!switch_strlen_zero(xtra_params)) {
snprintf(params, sizeof(params), "key=%s&user=%s&domain=%s&ip=%s&%s", key,
switch_snprintf(params, sizeof(params), "key=%s&user=%s&domain=%s&ip=%s&%s", key,
switch_str_nil(user_name), switch_str_nil(domain_name), switch_str_nil(ip), xtra_params);
} else {
snprintf(params, sizeof(params), "key=%s&user=%s&domain=%s&ip=%s", key,
switch_snprintf(params, sizeof(params), "key=%s&user=%s&domain=%s&ip=%s", key,
switch_str_nil(user_name), switch_str_nil(domain_name), switch_str_nil(ip));
xtra_params = "";
}
@@ -1374,7 +1374,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(uint8_t reload, const char **e
switch_thread_rwlock_wrlock(RWLOCK);
}
snprintf(path_buf, sizeof(path_buf), "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "freeswitch.xml");
switch_snprintf(path_buf, sizeof(path_buf), "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "freeswitch.xml");
if ((new_main = switch_xml_parse_file(path_buf))) {
*err = switch_xml_error(new_main);
switch_copy_string(not_so_threadsafe_error_buffer, *err, sizeof(not_so_threadsafe_error_buffer));