Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/lib/libcurses



On Thu, Jan 06, 2022 at 06:18:13 +0000, Brett Lymn wrote:

> Module Name:	src
> Committed By:	blymn
> Date:		Thu Jan  6 06:18:13 UTC 2022
> 
> Modified Files:
> 	src/lib/libcurses: slk.c
> 
> Log Message:
> Properly size and array to hold the larget return from wctomb.

I'm not sure this is correct.  You are introducing a variable length
array here.

POSIX says that 

  The <stdlib.h> header shall define the following macro which shall
  expand to a positive integer expression with type size_t:

  {MB_CUR_MAX}
      Maximum number of bytes in a character specified by the current
      locale (category LC_CTYPE).

the important exegetical fact about this passage is that it says
"integer expression", not "integer constant expression".

MB_LEN_MAX is maximum MB_CUR_MAX and "shall be suitable for use in #if
preprocessing directives".

I think this should be reverted.

-uwe


Home | Main Index | Thread Index | Old Index