[PATCH 1/2] tests:common: Increse buffer size to allow input for PQC testing.

Werner Koch wk at gnupg.org
Thu Jun 26 09:36:45 CEST 2025


On Thu, 26 Jun 2025 01:00, Jacob Bachmeyer said:

> 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

If we get such a long line something is wrong with the data.  After all
it should be easily editable by an editor.

In case someone wants to invest the time and regression risk; a switch
to es_read_line might be useful.  Something like

  maxlen = 16384; /* Set limit.  */
  while ((len = es_read_line (fp, &line, &length_of_line, &maxlen)) > 0)
    {
      if (!maxlen)
        {
          err = gpg_error (GPG_ERR_LINE_TOO_LONG);
          goto leave;
        }
      /* Strip newline and carriage return, if present.  */
      while (len > 0 && (line[len - 1] == '\n' || line[len - 1] == '\r'))
	line[--len] = '\0';

      if (split_fields (line, fields, DIM (fields)) < DIM(fields))
        continue; /* Skip empty lines and names w/o a value.  */
      if (*fields[0] == '#')
        continue; /* Skip comments.  */


libgpg-error (aka gpgrt) is anyway required.


Shalom-Salam,

   Werner


-- 
The pioneers of a warless world are the youth that
refuse military service.             - A. Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 247 bytes
Desc: not available
URL: <https://lists.gnupg.org/pipermail/gcrypt-devel/attachments/20250626/46cf6cc9/attachment-0001.sig>


More information about the Gcrypt-devel mailing list