[git commit] tls: better error message when TLS record is truncated
Denys Vlasenko
vda.linux at googlemail.com
Tue Nov 25 01:47:10 UTC 2025
commit: https://git.busybox.net/busybox/commit/?id=b143b3f1d49d1c89a45bbd11338d91815e57de3a
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
function old new delta
.rodata 106388 106438 +50
tls_xread_record 650 681 +31
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 81/0) Total: 81 bytes
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
networking/tls.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/networking/tls.c b/networking/tls.c
index ac6f0767f..ec8ce20e6 100644
--- a/networking/tls.c
+++ b/networking/tls.c
@@ -971,7 +971,10 @@ static int tls_xread_record(tls_state_t *tls, const char *expected)
tls->buffered_size = 0;
goto end;
}
- bb_perror_msg_and_die("short read, have only %d", total);
+ /* Used to say "wget: short read, have only 186" here. More informative: */
+ if (total < RECHDR_LEN)
+ bb_perror_msg_and_die("%s header: got %d bytes", "truncated TLS record", total);
+ bb_perror_msg_and_die("%s: expected %d, got %d bytes", "truncated TLS record", target, total);
}
dump_raw_in("<< %s\n", tls->inbuf + total, sz);
total += sz;
More information about the busybox-cvs
mailing list