在 2023-02-13 06:13, Martin Storsjö 写道:
When a subset of ssp functions were implemented in
7478c20848f60e6238547db63d1a5bc450d468cc, only functions that were
referenced with _FORTIFY_SOURCE were added. This set of functions
accidentally missed __gets_chk, which we do reference if fortification
is enabled.

Thus, this fixes an accidental omission.

While this function does implicitly reference stderr and the fgets
function, the fgets function symbol is provided by all CRT alternatives.
stderr expands to a call to __acrt_iob_func, and that is provided
by all CRT alternatives, either by the DLL itself or as statically
linked glue code. Therefore, this implementation should be safe
to use with both msvcr*.dll and UCRT.

Signed-off-by: Martin Storsjö <[email protected]>
---
  mingw-w64-crt/Makefile.am    |  3 ++-
  mingw-w64-crt/ssp/gets_chk.c | 42 ++++++++++++++++++++++++++++++++++++
  2 files changed, 44 insertions(+), 1 deletion(-)
  create mode 100644 mingw-w64-crt/ssp/gets_chk.c



LGTM. Thanks.

Side note: I am a bit curious how this function is supposed to be useful. Generally speaking `get()` should never be used.


--
Best regards,
LIU Hao

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to