AmendHub

jcs

/

subtext

/

amendments

Amendments on July 31, 2022

*: Add malloc annotations

jcs made amendment 226 10 months ago

bile: Pass object size to bile_unmarshall_object to check for overflow

Also add malloc annotations
jcs made amendment 225 10 months ago

util: Add note parameter to xmalloc, xcalloc, and xrealloc

If THINK C supported __func__ this would be much easier, but for now
we have to manually annotate every allocation. This will help find
the source of memory leaks.
jcs made amendment 224 10 months ago

Amendments on July 29, 2022

settings: Fix bogus free

jcs made amendment 223 10 months ago

Amendments on July 24, 2022

tcp: Don't bother manually zeroing open options

This whole struct has already been zeroed with memset.
jcs made amendment 222 10 months ago

Amendments on July 21, 2022

*: Use NewPtr instead of malloc, add malloc and free debugging

Instead of free(ptr), use xfree(&ptr) and after it calls
DisposePtr(ptr), it will update ptr to point at NULL to catch
use-after-frees.
When MALLOC_DEBUG is defined, each allocation is added to a
list, and removed when freed. If it's not in the list at free
time, it's a double-free. Also, instead of pointing pointers at
NULL, point them to a pre-defined block of zeroes and in the
idle loop, periodically check that this block is still zero. This
will also catch use-after-frees in a more reliable (but costly)
way.
jcs made amendment 220 10 months ago

Amendments on July 19, 2022

*: Add session signoff view, remove session_output_template

All remaining uses of session_output_template can use session_printf
which still does {{B}} and {{/B}} parsing.
Change session_output_view to session_output_view_or_printf to make it
easier to print a view and fallback to a string, rather than having to
check the result of session_output_view everywhere.
jcs made amendment 218 10 months ago

bile: Fix unmarshalling of a dynamic field with zero length

Don't xmalloc(0), just set it to a NULL pointer.
jcs made amendment 217 10 months ago

Amendments on July 17, 2022

telnet: Remove local banning, just use UDP sending to trusted proxy

Since we can't reject connections from banned IPs before opening the
TCP connection and we can get the trusted proxy to block IPs with
UDP messages, just rip local banning out of here.
jcs made amendment 216 10 months ago

mail: Don't allocate such a huge message body size

jcs made amendment 215 10 months ago

Amendments on July 16, 2022

folder: Show filename in the prompt, fix column alignment

jcs made amendment 214 10 months ago

board: Put the message index in the prompt, not the message id

It can be confusing when a user hits '1' to view the message in the
list showing "1 ..." but the prompt ends up showing "Boards:blah:4".
jcs made amendment 213 10 months ago

serial: If session_create fails, hang up

Maybe we should not put the modem in auto-answer and require manual
ATA, but then only do that if we can establish a session first. That
way we don't waste time negotiating the modem just to hang up.
jcs made amendment 212 10 months ago

*: Properly handle running out of sessions

Limit sessions to the number of uthreads we can handle, and then
reserve 1 session for the console.
In telnet, allocate one extra node so we can print a message to the
client that we have no free nodes, and then disconnect. Add a view
for this to make it editable.
In console, handle getting a null session back from session_create.
jcs made amendment 211 10 months ago

session+chat: Remove session_bar, implement simpler bar in chat

This is only used in chat and only to print a left-aligned bar.
jcs made amendment 210 10 months ago

*: Move some big char buffers from the stack to the heap

Use FILENAME_MAX in place of 256 where appropriate.
jcs made amendment 209 10 months ago

Amendments on July 15, 2022

chat: Use session_output instead of printf when printing a bar

These can be big and trigger an overflow panic in the printf buffer
jcs made amendment 208 10 months ago