On Sun, Oct 04 2020, Bruno Haible wrote: > Hi Jeremie, > >> The attached patch changes vasnprintf.c to avoid using %n in the general >> case, ie when the return value of snprintf is usable. This should help >> if more systems decide to make tighten %n usage. There are plans for >> that in OpenBSD land. > > Thanks for the suggestion. Yes, this is a good idea. (I didn't know about > the OpenBSD plans.) > >> The existing comments in vasnprintf.c mention systems where >> gl_SNPRINTF_RETVAL_C99 and gl_SNPRINTF_TRUNCATION_C99 pass. This patch >> only considers the usability of the return value of snprintf, as lack >> of truncation seems to be a different problem (apparently handled later >> in the code). > > I prefer to limit the shortcut to those platforms where both > gl_SNPRINTF_RETVAL_C99 and gl_SNPRINTF_TRUNCATION_C99 pass. These are > the conditions I found when considering this code in detail a couple of > years ago. Maybe you are right that only one of the conditions is needed; > but I don't want to live on the risky edge here. Your approach certainly makes sense. I considered something similar earlier. Your changes look good to me, thanks! -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE