Add low-impact warning flags, fix warnings found by new flags
Some checks failed
CI Code / Check spelling (pull_request) Successful in 22s
CI Code / Check coding style (pull_request) Failing after 32s
CI Code / Linux (ubuntu) (pull_request) Successful in 6m20s
CI Code / Linux (arch) (pull_request) Successful in 6m31s
CI Code / Code Coverage (pull_request) Successful in 8m51s
CI Code / Linux (debian) (pull_request) Successful in 9m6s
Some checks failed
CI Code / Check spelling (pull_request) Successful in 22s
CI Code / Check coding style (pull_request) Failing after 32s
CI Code / Linux (ubuntu) (pull_request) Successful in 6m20s
CI Code / Linux (arch) (pull_request) Successful in 6m31s
CI Code / Code Coverage (pull_request) Successful in 8m51s
CI Code / Linux (debian) (pull_request) Successful in 9m6s
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:
@@ -389,6 +389,8 @@ AM_CFLAGS="$AM_CFLAGS -Wall -Wextra -Wformat=2 -Wno-format-zero-length"
|
||||
AM_CFLAGS="$AM_CFLAGS -Wno-deprecated-declarations -Wno-unused-parameter -Wno-missing-field-initializers -Wno-sign-compare -Wno-cast-function-type"
|
||||
AM_CFLAGS="$AM_CFLAGS -Wnull-dereference -Wpointer-arith"
|
||||
AM_CFLAGS="$AM_CFLAGS -Wimplicit-function-declaration"
|
||||
AM_CFLAGS="$AM_CFLAGS -Wundef"
|
||||
AM_CFLAGS="$AM_CFLAGS -Wfloat-equal -Wredundant-decls"
|
||||
AM_CFLAGS="$AM_CFLAGS -fstack-protector-strong -fno-common"
|
||||
AM_CFLAGS="$AM_CFLAGS -D_FORTIFY_SOURCE=2"
|
||||
AM_CFLAGS="$AM_CFLAGS -std=gnu99 -ggdb3"
|
||||
@@ -396,7 +398,7 @@ AM_CFLAGS="$AM_CFLAGS -std=gnu99 -ggdb3"
|
||||
# GCC-specific warnings (not supported by clang) — test each one
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
for _flag in -Wlogical-op -Wduplicated-cond -Wduplicated-branches \
|
||||
-Wstringop-overflow; do
|
||||
-Wstringop-overflow -Warray-bounds=2 -Walloc-zero; do
|
||||
AC_MSG_CHECKING([whether $CC supports $_flag])
|
||||
CFLAGS="$saved_CFLAGS $_flag -Werror"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
|
||||
|
||||
@@ -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