Incidencia #45629

fc_vsnprintf() documented to follow C99, implementation C89 one

Abrir Fecha: 2022-09-10 07:14 Última actualización: 2022-10-23 08:36

Informador:
Propietario:
Tipo:
Estado:
Cerrado
Componente:
Prioridad:
5 - Medium
Gravedad:
5 - Medium
Resolución:
Fixed
Fichero:
1

Details

fc_vsnprintf() function header discuss return value, and states that C99 is followed: "If truncation does occur, returns the number of characters which would have been produced without truncation."

The implementation, on the other hand, converts any C99 values to C89 (-1 on truncation), and not vice versa:

/* Convert C99 return value to C89. */ if (r >= n) {

return -1;

}

Ticket History (3/8 Histories)

2022-09-10 07:14 Updated by: cazfi
  • New Ticket "fc_vsnprintf() documented to follow C99, implementation C89 one" created
2022-09-10 07:35 Updated by: cazfi
Comentario

While we should fix fc_vsnprintf() to return C99 compatible value when ever possible, there's nothing we can do if the underlying vsnprintf() implementation is not behaving.

- Update the configure check for what is considerd acceptable vsnprintf() implementation -> #45630
- Having fc_vsnprinf() to return C99 value at least most of the time (instead of always returning C89 value) fixes some users, and is unlikely to break any

2022-09-22 01:21 Updated by: cazfi
Comentario

While working on this, found #45682, that I think needs to be resolved first (considered a dependency of this)

2022-09-26 04:33 Updated by: cazfi
Comentario

Probably first make boundary check improvements in #45719

2022-09-26 04:34 Updated by: cazfi
  • Hito Update from (Ninguno) to 3.0.5 (cerrado)
  • Componente Update from (Ninguno) to General
2022-10-15 09:16 Updated by: cazfi
  • Propietario Update from (Ninguno) to cazfi
  • Resolución Update from Ninguno to Accepted
Comentario

Meant also to S2_6

2022-10-23 08:36 Updated by: cazfi
  • Estado Update from Open to Cerrado
  • Resolución Update from Accepted to Fixed

Editar

Please login to add comment to this ticket » Entrar