From c590eb3a44529ca7b462966d16230a40004123fa Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Mon, 27 Dec 2021 22:00:37 +0000 Subject: [PATCH] Whoops. Compile fixes. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3707 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/ssb.c | 10 +++++++++- src/ssb.js.c | 2 +- src/util.js.h | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/ssb.c b/src/ssb.c index 0666ad38..90f00978 100644 --- a/src/ssb.c +++ b/src/ssb.c @@ -512,6 +512,12 @@ bool tf_ssb_verify_and_strip_signature(JSContext* context, JSValue val, char* ou if (!verified) { printf("crypto_sign_verify_detached fail (r=%d)\n", r); + if (false) + { + printf("val=[%.*s]\n", (int)strlen(sigstr), sigstr); + printf("sig=%.*s\n", (int)(sigkind - str), str); + printf("public key=%.*s\n", (int)(type - author_id), author_id); + } } } else @@ -1061,7 +1067,9 @@ static bool _tf_ssb_connection_box_stream_recv(tf_ssb_connection_t* connection) connection->body_len = htons(*(uint16_t*)header); if (connection->body_len > k_tf_ssb_rpc_message_body_length_max) { - _tf_ssb_connection_close(connection, "body length is too large"); + char reason[512]; + snprintf(reason, sizeof(reason), "body length is too large: %d", connection->body_len); + _tf_ssb_connection_close(connection, reason); return false; } memcpy(connection->body_auth_tag, header + sizeof(uint16_t), sizeof(connection->body_auth_tag)); diff --git a/src/ssb.js.c b/src/ssb.js.c index 0a975f6b..5ebbbc0d 100644 --- a/src/ssb.js.c +++ b/src/ssb.js.c @@ -568,7 +568,7 @@ static void _tf_ssb_on_broadcasts_changed_callback(tf_ssb_t* ssb, void* user_dat JSValue response = JS_Call(context, callback, JS_UNDEFINED, 1, &argv); if (tf_util_report_error(context, response)) { - tf_ssb_remove_broadcasts_changed_callback(_tf_ssb_on_connections_changed_callback, user_data); + tf_ssb_remove_broadcasts_changed_callback(ssb, _tf_ssb_on_broadcasts_changed_callback, user_data); } JS_FreeValue(context, response); } diff --git a/src/util.js.h b/src/util.js.h index 32c354be..42e3e404 100644 --- a/src/util.js.h +++ b/src/util.js.h @@ -2,6 +2,8 @@ #include "quickjs.h" +#include + void tf_util_register(JSContext* context); JSValue tf_util_utf8_decode(JSContext* context, JSValue value); uint8_t* tf_util_try_get_array_buffer(JSContext* context, size_t* psize, JSValueConst obj);