Compare commits

...
5 Commits
Author SHA1 Message Date
deepend 1ae2d41378 fix menu.c build warnings 2026-10-14 05:32:13 -06:00
deepend-tildeclub 070603b0fe Merge pull request #421 from botovq/push-nsqmxvzmntnz
Fix clang -Wstrict-prototypes warnings
2026-10-13 18:16:48 -07:00
deepend-tildeclub 8f47b5cedf Merge pull request #418 from botovq/push-vzwkspvpmqvu
challengeauth_response (): move digest to stack
2026-10-13 18:13:15 -07:00
Theo Buehler 646ad029f0 Fix clang -Wstrict-prototypes warnings
This trivial diff gets rid of noisy warnings such as
```
./src/common/ignore.c:274:13: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
  274 | ignore_load ()
      |             ^
      |              void
```
when building with modern clang. This is cosmetic since these functions
are actually prototyped in a header, so if the header is in scope it's
not possible to call them with an arbitrary number of arguments.
2026-10-13 09:46:10 +02:00
Theo Buehler d47963247d challengeauth_response (): move digest to stack
Using HMAC ()'s facility of returning the digest in a static array is
not thread safe (this can't be fixed) and it is not portable to the
OpenSSL forks: BoringSSL removed support for this a decade ago (so
aws-lc doesn't support it either) and LibreSSL followed a few years
back.

There is no downside to having a 32-byte array on the stack and it would
make zoitechat safe to use from other forks without the need of patching
it.

Add an error check for the HMAC () call and handle the error in the
caller.
2026-10-13 09:25:22 +02:00
11 changed files with 26 additions and 47 deletions
+2 -2
View File
@@ -271,7 +271,7 @@ ignore_read_next_entry (char *my_cfg, struct ignore *ignore)
}
void
ignore_load ()
ignore_load (void)
{
struct ignore *ignore;
struct stat st;
@@ -302,7 +302,7 @@ ignore_load ()
}
void
ignore_save ()
ignore_save (void)
{
char buf[1024];
int fh;
+1 -1
View File
@@ -662,7 +662,7 @@ notify_isnotify (struct session *sess, char *name)
}
void
notify_cleanup ()
notify_cleanup (void)
{
GSList *list = notify_list;
GSList *nslist, *srvlist;
+5
View File
@@ -1288,6 +1288,11 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
char *user = net && net->user ? net->user : prefs.hex_irc_user_name;
response = challengeauth_response (user, serv->password, word[5]);
if (response == NULL)
{
PrintTextf (serv->server_session, _("Error building CHALLENGEAUTH for %s"), user);
return;
}
tcp_sendf (serv, "PRIVMSG %s :CHALLENGEAUTH %s %s %s\r\n",
CHALLENGEAUTH_NICK,
+3 -3
View File
@@ -1808,7 +1808,7 @@ pevent_check_all_loaded (void)
}
void
load_text_events ()
load_text_events (void)
{
memset (&pntevts_text, 0, sizeof (char *) * (NUM_XP));
memset (&pntevts, 0, sizeof (char *) * (NUM_XP));
@@ -2488,7 +2488,7 @@ sound_load_event (char *evt, char *file)
}
void
sound_load ()
sound_load (void)
{
int fd;
char buf[512];
@@ -2521,7 +2521,7 @@ sound_load ()
}
void
sound_save ()
sound_save (void)
{
int fd, i;
char buf[512];
+7 -2
View File
@@ -1453,7 +1453,7 @@ challengeauth_response (const char *username, const char *password, const char *
char *passhash;
char *key;
char *keyhash;
unsigned char *digest;
unsigned char digest[SHA256_DIGEST_LENGTH];
GString *buf = g_string_new_len (NULL, SHA256_DIGEST_LENGTH * 2);
user = rfc_strlower (username); /* convert username to lowercase as per the RFC */
@@ -1469,7 +1469,12 @@ challengeauth_response (const char *username, const char *password, const char *
keyhash = str_sha256hash (key);
g_free (key);
digest = HMAC (EVP_sha256 (), keyhash, strlen (keyhash), (unsigned char *) challenge, strlen (challenge), NULL, NULL);
if (HMAC (EVP_sha256 (), keyhash, strlen (keyhash), (unsigned char *) challenge, strlen (challenge), digest, NULL) == NULL)
{
g_free (keyhash);
g_string_free (buf, TRUE);
return NULL;
}
g_free (keyhash);
for (i = 0; i < SHA256_DIGEST_LENGTH; i++)
+2 -2
View File
@@ -426,7 +426,7 @@ key_binding_is_builtin (struct key_binding *kb)
}
void
key_init ()
key_init (void)
{
if (key_load_kbs () == 1)
{
@@ -1219,7 +1219,7 @@ key_dialog_load (GtkListStore *store)
}
void
key_dialog_show ()
key_dialog_show (void)
{
GtkWidget *vbox, *box, *pane, *scroll;
GtkWidget *view, *xtext, *delete_button;
+1 -1
View File
@@ -336,7 +336,7 @@ ignore_stats_entry (GtkWidget * box, char *label, int value)
}
void
ignore_gui_open ()
ignore_gui_open (void)
{
GtkWidget *vbox, *box, *stat_box, *frame;
GtkWidget *view;
-34
View File
@@ -297,40 +297,6 @@ mg_color_component_to_pango (double value)
return (guint16)(value * 65535.0 + 0.5);
}
static void
mg_apply_font_css (GtkWidget *widget, const PangoFontDescription *desc,
const char *class_name, const char *provider_key)
{
GtkStyleContext *context;
GtkCssProvider *provider;
GString *css;
if (!widget || !desc)
return;
context = gtk_widget_get_style_context (widget);
if (!context)
return;
provider = g_object_get_data (G_OBJECT (widget), provider_key);
if (!provider)
{
provider = gtk_css_provider_new ();
g_object_set_data_full (G_OBJECT (widget), provider_key, provider, g_object_unref);
}
css = g_string_new (".");
g_string_append (css, class_name);
g_string_append (css, " {");
gtkutil_append_font_css (css, desc);
g_string_append (css, " }");
gtk_css_provider_load_from_data (provider, css->str, -1, NULL);
g_string_free (css, TRUE);
gtk_style_context_add_class (context, class_name);
theme_css_apply_widget_provider (widget, GTK_STYLE_PROVIDER (provider));
}
static void
mg_set_label_alignment_start (GtkWidget *widget)
{
+3
View File
@@ -1962,7 +1962,10 @@ menu_about (GtkWidget *wid, gpointer sess)
gtk_about_dialog_set_logo (dialog, pix_zoitechat);
gtk_about_dialog_set_copyright (dialog, "\302\251 1998-2010 Peter \305\275elezn\303\275\n\302\251 2009-2014 Berke Viktor\n\302\251 2015-2025 Patrick Griffis\n\302\251 2026 deepend");
gtk_about_dialog_set_comments (dialog, comment);
/* Preserve the About dialog's existing action-area button layout. */
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
actions = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
G_GNUC_END_IGNORE_DEPRECATIONS
children = gtk_container_get_children (GTK_CONTAINER (actions));
for (child = children; child; child = child->next)
gtk_widget_destroy (GTK_WIDGET (child->data));
+1 -1
View File
@@ -486,7 +486,7 @@ pevent_hlist_treeview_new (GtkWidget *box)
}
void
pevent_dialog_show ()
pevent_dialog_show (void)
{
GtkWidget *vbox, *hbox, *wid, *pane, *preview_pane;
XTextColor xtext_palette[XTEXT_COLS];
+1 -1
View File
@@ -187,7 +187,7 @@ populate_cb (char *urltext, gpointer userdata)
}
void
url_opengui ()
url_opengui (void)
{
GtkWidget *vbox, *hbox, *view;
char buf[128];