[RTS] Harden against buffer overflow
authorBartosz Nitka <niteria@gmail.com>
Wed, 13 Sep 2017 12:28:00 +0000 (08:28 -0400)
committerBen Gamari <ben@smart-cactus.org>
Wed, 13 Sep 2017 14:40:02 +0000 (10:40 -0400)
commite62391a75c8dc304f902e732fc63eefb21930aca
tree6800ce6725117eae34d1514b7cf7fbf475cf1186
parent91262e75dd1d80f8f28a3922934ec7e59290e28c
[RTS] Harden against buffer overflow

This sprintf is safe thanks to the guarantees on the format strings that
we pass to it.  Well, almost. The GR_FILENAME_FMT_GUM format would not
have satisfied them if it was still used.

If someone makes a mistake that's a potential privilege escalation,
so I think it's reasonable to switch to snprintf to protect against
that remote possibility.

Test Plan: it builds, CI

Reviewers: simonmar, bgamari, austin, erikd

Reviewed By: bgamari

Subscribers: rwbarton, thomie

Differential Revision: https://phabricator.haskell.org/D3944
includes/rts/Flags.h
rts/RtsFlags.c