[PATCH 1/2] tests:common: Increse buffer size to allow input for PQC testing.
Jacob Bachmeyer
jcb62281 at gmail.com
Thu Jun 26 08:00:15 CEST 2025
On 6/26/25 00:10, NIIBE Yutaka via Gcrypt-devel wrote:
> * tests/t-common.h (read_textline): Increase the buffer size.
I understand that this is testsuite code, so a fixed stack buffer is not
the serious problem it could otherwise be, but why not replace the fixed
buffer with a heap-allocated buffer, expanded as needed using
realloc()? This would also allow the working buffer to be returned and
freed by the caller, eliminating the final xstrdup() call.
A quick glance at src/stdmem.c suggests that libgcrypt already has the
infrastructure to implement this.
I suggest making the buffer expansion power-of-2 starting from some
initial size (256?) and doubling each time the buffer is filled without
having read a complete line. A hard limit (1MiB?) could be useful as well.
-- Jacob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gcrypt-devel/attachments/20250626/b4697fe5/attachment.html>
More information about the Gcrypt-devel
mailing list