fix(ui,db): harden NULL handling, fix CWE-134, optimize iterations
Some checks failed
CI Code / Code Coverage (push) Failing after 10m34s
CI Code / Check spelling (push) Failing after 10m47s
CI Code / Check coding style (push) Failing after 11m4s
CI Code / Linux (ubuntu) (push) Failing after 11m19s
CI Code / Linux (debian) (push) Failing after 11m28s
CI Code / Linux (arch) (push) Failing after 11m38s
Some checks failed
CI Code / Code Coverage (push) Failing after 10m34s
CI Code / Check spelling (push) Failing after 10m47s
CI Code / Check coding style (push) Failing after 11m4s
CI Code / Linux (ubuntu) (push) Failing after 11m19s
CI Code / Linux (debian) (push) Failing after 11m28s
CI Code / Linux (arch) (push) Failing after 11m38s
security(CWE-134): fix format string injections + add CI check fix(ui): subwindow lifecycle, newwin/newpad guards, fallback timestamps fix(db): sqlite cleanup on failures, sqlite3_close_v2 fix(xmpp): queued_messages loop, barejid leak perf(core): g_hash_table_iter_init instead of g_hash_table_get_keys refactor(ui): CLAMP macro in _check_subwin_width test: XEP-0012 and XEP-0045 functional tests Author: jabber.developer2 Closes #58, #85
This commit is contained in:
@@ -141,18 +141,16 @@ autocompleters_complete(const char* const input, gboolean previous)
|
||||
while (curr_hash) {
|
||||
GHashTable* key_to_ac = curr_hash->data;
|
||||
|
||||
GList* keys = g_hash_table_get_keys(key_to_ac);
|
||||
GList* curr = keys;
|
||||
while (curr) {
|
||||
result = autocomplete_param_with_ac(input, curr->data, g_hash_table_lookup(key_to_ac, curr->data), TRUE, previous);
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
g_hash_table_iter_init(&iter, key_to_ac);
|
||||
while (g_hash_table_iter_next(&iter, &key, &value)) {
|
||||
result = autocomplete_param_with_ac(input, key, value, TRUE, previous);
|
||||
if (result) {
|
||||
g_list_free(ac_hashes);
|
||||
g_list_free(keys);
|
||||
return result;
|
||||
}
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
g_list_free(keys);
|
||||
|
||||
curr_hash = g_list_next(curr_hash);
|
||||
}
|
||||
@@ -162,22 +160,19 @@ autocompleters_complete(const char* const input, gboolean previous)
|
||||
curr_hash = filepath_hashes;
|
||||
while (curr_hash) {
|
||||
GHashTable* prefixes_hash = curr_hash->data;
|
||||
GList* prefixes = g_hash_table_get_keys(prefixes_hash);
|
||||
GList* curr_prefix = prefixes;
|
||||
while (curr_prefix) {
|
||||
char* prefix = curr_prefix->data;
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
g_hash_table_iter_init(&iter, prefixes_hash);
|
||||
while (g_hash_table_iter_next(&iter, &key, &value)) {
|
||||
char* prefix = (char*)key;
|
||||
if (g_str_has_prefix(input, prefix)) {
|
||||
result = cmd_ac_complete_filepath(input, prefix, previous);
|
||||
if (result) {
|
||||
g_list_free(filepath_hashes);
|
||||
g_list_free(prefixes);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
curr_prefix = g_list_next(curr_prefix);
|
||||
}
|
||||
g_list_free(prefixes);
|
||||
|
||||
curr_hash = g_list_next(curr_hash);
|
||||
}
|
||||
|
||||
@@ -149,15 +149,14 @@ callbacks_remove(const char* const plugin_name)
|
||||
{
|
||||
GHashTable* command_hash = g_hash_table_lookup(p_commands, plugin_name);
|
||||
if (command_hash) {
|
||||
GList* commands = g_hash_table_get_keys(command_hash);
|
||||
GList* curr = commands;
|
||||
while (curr) {
|
||||
char* command = curr->data;
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
g_hash_table_iter_init(&iter, command_hash);
|
||||
while (g_hash_table_iter_next(&iter, &key, &value)) {
|
||||
char* command = (char*)key;
|
||||
cmd_ac_remove(command);
|
||||
cmd_ac_remove_help(&command[1]);
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
g_list_free(commands);
|
||||
}
|
||||
|
||||
g_hash_table_remove(p_commands, plugin_name);
|
||||
@@ -165,13 +164,12 @@ callbacks_remove(const char* const plugin_name)
|
||||
|
||||
GHashTable* tag_to_win_cb_hash = g_hash_table_lookup(p_window_callbacks, plugin_name);
|
||||
if (tag_to_win_cb_hash) {
|
||||
GList* tags = g_hash_table_get_keys(tag_to_win_cb_hash);
|
||||
GList* curr = tags;
|
||||
while (curr) {
|
||||
wins_close_plugin(curr->data);
|
||||
curr = g_list_next(curr);
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
g_hash_table_iter_init(&iter, tag_to_win_cb_hash);
|
||||
while (g_hash_table_iter_next(&iter, &key, &value)) {
|
||||
wins_close_plugin(key);
|
||||
}
|
||||
g_list_free(tags);
|
||||
}
|
||||
|
||||
g_hash_table_remove(p_window_callbacks, plugin_name);
|
||||
|
||||
@@ -107,10 +107,11 @@ disco_remove_features(const char* plugin_name)
|
||||
return;
|
||||
}
|
||||
|
||||
GList* plugin_feature_list = g_hash_table_get_keys(plugin_features_set);
|
||||
GList* curr = plugin_feature_list;
|
||||
while (curr) {
|
||||
char* feature = curr->data;
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
g_hash_table_iter_init(&iter, plugin_features_set);
|
||||
while (g_hash_table_iter_next(&iter, &key, &value)) {
|
||||
char* feature = (char*)key;
|
||||
if (g_hash_table_contains(features, feature)) {
|
||||
void* refcountp = g_hash_table_lookup(features, feature);
|
||||
int refcount = GPOINTER_TO_INT(refcountp);
|
||||
@@ -121,10 +122,7 @@ disco_remove_features(const char* plugin_name)
|
||||
g_hash_table_replace(features, strdup(feature), GINT_TO_POINTER(refcount));
|
||||
}
|
||||
}
|
||||
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
g_list_free(plugin_feature_list);
|
||||
}
|
||||
|
||||
GList*
|
||||
|
||||
@@ -887,8 +887,8 @@ _python_undefined_error(ProfPlugin* plugin, char* hook, char* type)
|
||||
g_string_append(err_msg, hook);
|
||||
g_string_append(err_msg, "(): return value undefined, expected ");
|
||||
g_string_append(err_msg, type);
|
||||
log_error(err_msg->str);
|
||||
cons_show_error(err_msg->str);
|
||||
log_error("%s", err_msg->str);
|
||||
cons_show_error("%s", err_msg->str);
|
||||
g_string_free(err_msg, TRUE);
|
||||
}
|
||||
|
||||
@@ -901,8 +901,8 @@ _python_type_error(ProfPlugin* plugin, char* hook, char* type)
|
||||
g_string_append(err_msg, hook);
|
||||
g_string_append(err_msg, "(): incorrect return type, expected ");
|
||||
g_string_append(err_msg, type);
|
||||
log_error(err_msg->str);
|
||||
cons_show_error(err_msg->str);
|
||||
log_error("%s", err_msg->str);
|
||||
cons_show_error("%s", err_msg->str);
|
||||
g_string_free(err_msg, TRUE);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user