fix: OTR/presence/OMEMO correctness, stanza-id disco gate, build hardening
All checks were successful
CI Code / Check spelling (push) Successful in 17s
CI Code / Check coding style (push) Successful in 32s
CI Code / Code Coverage (push) Successful in 3m45s
CI Code / Linux (debian) (push) Successful in 4m42s
CI Code / Linux (ubuntu) (push) Successful in 4m49s
CI Code / Linux (arch) (push) Successful in 6m25s
All checks were successful
CI Code / Check spelling (push) Successful in 17s
CI Code / Check coding style (push) Successful in 32s
CI Code / Code Coverage (push) Successful in 3m45s
CI Code / Linux (debian) (push) Successful in 4m42s
CI Code / Linux (ubuntu) (push) Successful in 4m49s
CI Code / Linux (arch) (push) Successful in 6m25s
- OTR: strip the whitespace tag by shifting the full message tail incl. the NUL, not tag_length bytes, so the body is no longer duplicated for messages longer than the tag. - presence: snapshot the resource fields before connection_add_available_resource() takes ownership, removing a use-after-free in the own-presence path. - OMEMO: propagate _omemo_finalize_identity_load() failure on connect (log + cons_show_error + stop) instead of leaving OMEMO silently unavailable. - OMEMO: guard NULL fingerprint decode in _omemo_fingerprint_decode / omemo_is_trusted_identity / omemo_trust and log every decode failure instead of failing silently. - stanza-id: gate XEP-0359 dedup on disco urn:xmpp:sid:0 (the `by` JID or its domain), falling back to no-dedup when caps are unknown; add functional tests for trusted vs untrusted server. - accounts: narrow the group-name sanitizer to the characters GKeyFile forbids in headers ([ ] \n \r), keeping `=` and `#`, so read/write stays symmetric. - build: re-introduce compiler/sanitizer flags in a Pikaur-safe form (opt-in sanitizers, -Wsign-compare) and fix the resulting -Wsign-compare warnings (incl. proftest _mkdir_recursive).fix: OTR/presence/OMEMO correctness, stanza-id disco gate, build hardening Author: jabber.developer2 <jabber.developer2@jabber.space>
This commit is contained in:
@@ -260,7 +260,12 @@ omemo_on_connect(ProfAccount* account)
|
||||
return;
|
||||
}
|
||||
|
||||
_omemo_finalize_identity_load(account);
|
||||
if (!_omemo_finalize_identity_load(account)) {
|
||||
omemo_ctx.loaded = FALSE;
|
||||
log_error("[OMEMO] failed to load OMEMO state from disk for %s", account->jid);
|
||||
cons_show_error("OMEMO: could not load encryption state from disk; OMEMO will be unavailable this session.");
|
||||
return;
|
||||
}
|
||||
|
||||
wins_omemo_trust_changed(NULL);
|
||||
}
|
||||
@@ -1278,8 +1283,12 @@ omemo_is_trusted_identity(const char* const jid, const char* const fingerprint)
|
||||
.device_id = GPOINTER_TO_UINT(device_id),
|
||||
};
|
||||
|
||||
size_t fingerprint_len;
|
||||
size_t fingerprint_len = 0;
|
||||
unsigned char* fingerprint_raw = _omemo_fingerprint_decode(fingerprint, &fingerprint_len);
|
||||
if (!fingerprint_raw) {
|
||||
log_error("[OMEMO] omemo_is_trusted_identity: failed to decode fingerprint for %s", jid);
|
||||
return FALSE;
|
||||
}
|
||||
unsigned char djb_type[] = { '\x05' };
|
||||
signal_buffer* buffer = signal_buffer_create(djb_type, 1);
|
||||
buffer = signal_buffer_append(buffer, fingerprint_raw, fingerprint_len);
|
||||
@@ -1463,6 +1472,10 @@ _omemo_fingerprint(ec_public_key* identity, gboolean formatted)
|
||||
static unsigned char*
|
||||
_omemo_fingerprint_decode(const char* const fingerprint, size_t* len)
|
||||
{
|
||||
if (!fingerprint) {
|
||||
*len = 0;
|
||||
return NULL;
|
||||
}
|
||||
unsigned char* output = malloc(strlen(fingerprint) / 2 + 1);
|
||||
if (!output) {
|
||||
*len = 0;
|
||||
@@ -1529,6 +1542,11 @@ omemo_trust(const char* const jid, const char* const fingerprint_formatted)
|
||||
};
|
||||
|
||||
unsigned char* fingerprint_raw = _omemo_fingerprint_decode(fingerprint_formatted, &len);
|
||||
if (!fingerprint_raw) {
|
||||
log_error("[OMEMO] omemo_trust: failed to decode fingerprint for %s", jid);
|
||||
cons_show_error("Failed to trust device: could not decode fingerprint.");
|
||||
return;
|
||||
}
|
||||
unsigned char djb_type[] = { '\x05' };
|
||||
signal_buffer* buffer = signal_buffer_create(djb_type, 1);
|
||||
buffer = signal_buffer_append(buffer, fingerprint_raw, len);
|
||||
@@ -1546,8 +1564,10 @@ omemo_untrust(const char* const jid, const char* const fingerprint_formatted)
|
||||
{
|
||||
size_t len;
|
||||
unsigned char* identity = _omemo_fingerprint_decode(fingerprint_formatted, &len);
|
||||
if (!identity)
|
||||
if (!identity) {
|
||||
log_error("[OMEMO] omemo_untrust: failed to decode fingerprint for %s", jid);
|
||||
return;
|
||||
}
|
||||
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
|
||||
Reference in New Issue
Block a user