Whoops. Compile fixes.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3707 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2021-12-27 22:00:37 +00:00
parent 2e1b0089ae
commit c590eb3a44
3 changed files with 12 additions and 2 deletions

View File

@ -512,6 +512,12 @@ bool tf_ssb_verify_and_strip_signature(JSContext* context, JSValue val, char* ou
if (!verified) if (!verified)
{ {
printf("crypto_sign_verify_detached fail (r=%d)\n", r); 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 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); connection->body_len = htons(*(uint16_t*)header);
if (connection->body_len > k_tf_ssb_rpc_message_body_length_max) 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; return false;
} }
memcpy(connection->body_auth_tag, header + sizeof(uint16_t), sizeof(connection->body_auth_tag)); memcpy(connection->body_auth_tag, header + sizeof(uint16_t), sizeof(connection->body_auth_tag));

View File

@ -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); JSValue response = JS_Call(context, callback, JS_UNDEFINED, 1, &argv);
if (tf_util_report_error(context, response)) 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); JS_FreeValue(context, response);
} }

View File

@ -2,6 +2,8 @@
#include "quickjs.h" #include "quickjs.h"
#include <stdbool.h>
void tf_util_register(JSContext* context); void tf_util_register(JSContext* context);
JSValue tf_util_utf8_decode(JSContext* context, JSValue value); JSValue tf_util_utf8_decode(JSContext* context, JSValue value);
uint8_t* tf_util_try_get_array_buffer(JSContext* context, size_t* psize, JSValueConst obj); uint8_t* tf_util_try_get_array_buffer(JSContext* context, size_t* psize, JSValueConst obj);