mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-19 19:06:21 +00:00
Add low-impact warning flags, fix warnings found by new flags
Add compiler flags: -Wundef, -Wfloat-equal, -Wredundant-decls, -Walloc-zero. Fix -Wredundant-decls warnings: - Remove stale cons_show_desktop_prefs declaration (ui.h) - Remove duplicate connection_set_priority prototype (connection.h) - Remove stale omemo_devicelist_configure_and_request declaration (omemo.h) Fix potential buffer overflow in stanza.c: - Increase pri_str and idle_str buffers from 10 to 12 bytes (INT_MIN = -2147483648 needs 12 bytes including NUL)
This commit is contained in:
@@ -168,21 +168,21 @@ log_database_init(ProfAccount* account)
|
||||
// replaces_db_id is ID (primary key) of the original message that LMC message corrects/replaces
|
||||
// replaced_by_db_id is ID (primary key) of the last correcting (LMC) message for the original message
|
||||
const char* query = "CREATE TABLE IF NOT EXISTS `ChatLogs` ("
|
||||
"`id` INTEGER PRIMARY KEY AUTOINCREMENT, "
|
||||
"`from_jid` TEXT NOT NULL, "
|
||||
"`to_jid` TEXT NOT NULL, "
|
||||
"`from_resource` TEXT, "
|
||||
"`to_resource` TEXT, "
|
||||
"`message` TEXT, "
|
||||
"`timestamp` TEXT, "
|
||||
"`type` TEXT, "
|
||||
"`stanza_id` TEXT, "
|
||||
"`archive_id` TEXT, "
|
||||
"`encryption` TEXT, "
|
||||
"`marked_read` INTEGER, "
|
||||
"`replace_id` TEXT, "
|
||||
"`replaces_db_id` INTEGER, "
|
||||
"`replaced_by_db_id` INTEGER)";
|
||||
"`id` INTEGER PRIMARY KEY AUTOINCREMENT, "
|
||||
"`from_jid` TEXT NOT NULL, "
|
||||
"`to_jid` TEXT NOT NULL, "
|
||||
"`from_resource` TEXT, "
|
||||
"`to_resource` TEXT, "
|
||||
"`message` TEXT, "
|
||||
"`timestamp` TEXT, "
|
||||
"`type` TEXT, "
|
||||
"`stanza_id` TEXT, "
|
||||
"`archive_id` TEXT, "
|
||||
"`encryption` TEXT, "
|
||||
"`marked_read` INTEGER, "
|
||||
"`replace_id` TEXT, "
|
||||
"`replaces_db_id` INTEGER, "
|
||||
"`replaced_by_db_id` INTEGER)";
|
||||
if (SQLITE_OK != sqlite3_exec(g_chatlog_database, query, NULL, 0, &err_msg)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -322,7 +322,6 @@ void cons_wrap_setting(void);
|
||||
void cons_time_setting(void);
|
||||
void cons_wintitle_setting(void);
|
||||
void cons_notify_setting(void);
|
||||
void cons_show_desktop_prefs(void);
|
||||
void cons_states_setting(void);
|
||||
void cons_outtype_setting(void);
|
||||
void cons_intype_setting(void);
|
||||
|
||||
@@ -51,7 +51,6 @@ jabber_conn_status_t connection_register(const char* const altdomain, int port,
|
||||
void connection_set_disconnected(void);
|
||||
|
||||
void connection_set_priority(const int priority);
|
||||
void connection_set_priority(int priority);
|
||||
void connection_set_disco_items(GSList* items);
|
||||
|
||||
xmpp_conn_t* connection_get_conn(void);
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#include "xmpp/iq.h"
|
||||
|
||||
void omemo_devicelist_subscribe(void);
|
||||
void omemo_devicelist_configure_and_request(void);
|
||||
void omemo_devicelist_publish(GList* device_list);
|
||||
void omemo_devicelist_request(const char* const jid);
|
||||
void omemo_bundle_publish(gboolean first);
|
||||
|
||||
@@ -1948,7 +1948,7 @@ stanza_attach_priority(xmpp_ctx_t* const ctx, xmpp_stanza_t* const presence, con
|
||||
return;
|
||||
}
|
||||
|
||||
char pri_str[10];
|
||||
char pri_str[12];
|
||||
snprintf(pri_str, sizeof(pri_str), "%d", pri);
|
||||
|
||||
xmpp_stanza_t* priority = xmpp_stanza_new(ctx);
|
||||
@@ -2007,7 +2007,7 @@ stanza_attach_last_activity(xmpp_ctx_t* const ctx,
|
||||
xmpp_stanza_t* query = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_name(query, STANZA_NAME_QUERY);
|
||||
xmpp_stanza_set_ns(query, STANZA_NS_LASTACTIVITY);
|
||||
char idle_str[10];
|
||||
char idle_str[12];
|
||||
snprintf(idle_str, sizeof(idle_str), "%d", idle);
|
||||
xmpp_stanza_set_attribute(query, STANZA_ATTR_SECONDS, idle_str);
|
||||
xmpp_stanza_add_child(presence, query);
|
||||
|
||||
Reference in New Issue
Block a user