mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-30 22:46:21 +00:00
fix: follow-ups to cherry-picked d3d7c328b
- src/xmpp/jid.c: add missing #include "log.h" —d3d7c328bintroduced a log_debug() call in jid_create without pulling in the header, so the source tree did not actually build. - src/omemo/omemo.c omemo_on_message_send: add the missing NULL-check after the gcry_malloc_secure calls for 'tag' / 'key_tag' so a real OOM does not sail into the memcpy/encrypt path. (The 'key' checkd3d7c328badded is defensive only — gcry_random_bytes_secure aborts internally on failure.) - src/omemo/omemo.c _cache_device_identity: drop the second 'if (!fingerprint) return' on the autocomplete path. fingerprint is already NULL-checked at the top of the function and is not reassigned in between, so the second guard is dead code (upstream artefact). - src/tools/editor.c launch_editor: replace the g_main_context_acquire/release pair with g_child_watch_source_new(getpid()) + g_source_unref. acquire/release does not install GLib's SIGCHLD handler — that handler is registered as a side effect of constructing a GChildWatchSource. Now we actually pre-arm SIGCHLD before forking, which is what d3d7c328b's comment claimed. - src/ui/statusbar.c status_bar_inactive / _create_tab: switch the remaining two literal '10' tab-id values to the CONSOLE_TAB_ID define introduced byd3d7c328b, then inline the expression directly into the GINT_TO_POINTER() argument so the one-shot local 'true_win' goes away. Verified with ci-build.sh in Debian docker: all 4 configs pass (644/0, 605/0, 605/0, 644/0 unit + 130/0 functional).
This commit is contained in:
@@ -804,6 +804,10 @@ omemo_on_message_send(ProfWin* win, const char* const message, gboolean request_
|
|||||||
tag_len = AES128_GCM_TAG_LENGTH;
|
tag_len = AES128_GCM_TAG_LENGTH;
|
||||||
tag = gcry_malloc_secure(tag_len);
|
tag = gcry_malloc_secure(tag_len);
|
||||||
key_tag = gcry_malloc_secure(AES128_GCM_KEY_LENGTH + AES128_GCM_TAG_LENGTH);
|
key_tag = gcry_malloc_secure(AES128_GCM_KEY_LENGTH + AES128_GCM_TAG_LENGTH);
|
||||||
|
if (!tag || !key_tag) {
|
||||||
|
log_error("[OMEMO][SEND] cannot allocate secure buffers");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
key = gcry_random_bytes_secure(AES128_GCM_KEY_LENGTH + AES128_GCM_IV_LENGTH, GCRY_VERY_STRONG_RANDOM);
|
key = gcry_random_bytes_secure(AES128_GCM_KEY_LENGTH + AES128_GCM_IV_LENGTH, GCRY_VERY_STRONG_RANDOM);
|
||||||
if (!key) {
|
if (!key) {
|
||||||
@@ -1993,10 +1997,6 @@ _cache_device_identity(const char* const jid, uint32_t device_id, ec_public_key*
|
|||||||
g_hash_table_insert(omemo_static_data.fingerprint_ac, strdup(jid), ac);
|
g_hash_table_insert(omemo_static_data.fingerprint_ac, strdup(jid), ac);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fingerprint) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* formatted_fingerprint = omemo_format_fingerprint(fingerprint);
|
char* formatted_fingerprint = omemo_format_fingerprint(fingerprint);
|
||||||
if (formatted_fingerprint) {
|
if (formatted_fingerprint) {
|
||||||
autocomplete_add(ac, formatted_fingerprint);
|
autocomplete_add(ac, formatted_fingerprint);
|
||||||
|
|||||||
@@ -121,11 +121,11 @@ launch_editor(gchar* initial_content, void (*callback)(gchar* content, void* dat
|
|||||||
|
|
||||||
ui_suspend();
|
ui_suspend();
|
||||||
|
|
||||||
// Ensure GLib's SIGCHLD handler is installed before forking to prevent
|
// Force GLib to install its SIGCHLD handler before forking. Creating a
|
||||||
// zombie children if the editor is launched before the main loop starts.
|
// GChildWatchSource for our own pid is the documented trigger; we never
|
||||||
GMainContext* main_ctx = g_main_context_default();
|
// attach or dispatch it, just rely on the side effect.
|
||||||
g_main_context_acquire(main_ctx);
|
GSource* sigchld_warmup = g_child_watch_source_new(getpid());
|
||||||
g_main_context_release(main_ctx);
|
g_source_unref(sigchld_warmup);
|
||||||
|
|
||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
if (pid == -1) {
|
if (pid == -1) {
|
||||||
|
|||||||
@@ -170,12 +170,7 @@ status_bar_current(guint i)
|
|||||||
void
|
void
|
||||||
status_bar_inactive(const int win)
|
status_bar_inactive(const int win)
|
||||||
{
|
{
|
||||||
int true_win = win;
|
g_hash_table_remove(statusbar->tabs, GINT_TO_POINTER((win == 0) ? CONSOLE_TAB_ID : win));
|
||||||
if (true_win == 0) {
|
|
||||||
true_win = 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_hash_table_remove(statusbar->tabs, GINT_TO_POINTER(true_win));
|
|
||||||
|
|
||||||
status_bar_draw();
|
status_bar_draw();
|
||||||
}
|
}
|
||||||
@@ -183,8 +178,6 @@ status_bar_inactive(const int win)
|
|||||||
void
|
void
|
||||||
_create_tab(const int win, win_type_t wintype, char* identifier, gboolean highlight)
|
_create_tab(const int win, win_type_t wintype, char* identifier, gboolean highlight)
|
||||||
{
|
{
|
||||||
int true_win = win == 0 ? 10 : win;
|
|
||||||
|
|
||||||
StatusBarTab* tab = g_new0(StatusBarTab, 1);
|
StatusBarTab* tab = g_new0(StatusBarTab, 1);
|
||||||
tab->identifier = strdup(identifier);
|
tab->identifier = strdup(identifier);
|
||||||
tab->highlight = highlight;
|
tab->highlight = highlight;
|
||||||
@@ -214,7 +207,7 @@ _create_tab(const int win, win_type_t wintype, char* identifier, gboolean highli
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_hash_table_replace(statusbar->tabs, GINT_TO_POINTER(true_win), tab);
|
g_hash_table_replace(statusbar->tabs, GINT_TO_POINTER((win == 0) ? CONSOLE_TAB_ID : win), tab);
|
||||||
|
|
||||||
status_bar_draw();
|
status_bar_draw();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "log.h"
|
||||||
#include "xmpp/jid.h"
|
#include "xmpp/jid.h"
|
||||||
|
|
||||||
#define JID_MAX_PART_LEN 1023
|
#define JID_MAX_PART_LEN 1023
|
||||||
|
|||||||
Reference in New Issue
Block a user