summaryrefslogtreecommitdiff
path: root/src/lib/string/printf.c
AgeCommit message (Collapse)Author
2021-11-05Prefer use of __MINGW_PRINTF/SCANF_FORMAT if available.Nick Mathewson
Mingw headers sometimes like to define alternative scanf/printf format attributes depending on whether they're using clang, UCRT, MINGW_ANSI_STDIO, or the microsoft version of printf/scanf. This change attempts to use the right one on the given platform. This is an attempt to fix part of #40355.
2021-03-12Update copyrights to 2021, using "make update-copyright"Nick Mathewson
2020-01-08It's 2020. Update the copyright dates with "make update-copyright"Nick Mathewson
2019-07-29Merge branch 'tor-github/pr/1179' into maint-0.4.1David Goulet
2019-07-19Prevent UB on signed overflow.Tobias Stoeckmann
Overflowing a signed integer in C is an undefined behaviour. It is possible to trigger this undefined behaviour in tor_asprintf on Windows or systems lacking vasprintf. On these systems, eiter _vscprintf or vsnprintf is called to retrieve the required amount of bytes to hold the string. These functions can return INT_MAX. The easiest way to recreate this is the use of a specially crafted configuration file, e.g. containing the line: FirewallPorts AAAAA<in total 2147483610 As> This line triggers the needed tor_asprintf call which eventually leads to an INT_MAX return value from _vscprintf or vsnprintf. The needed byte for \0 is added to the result, triggering the overflow and therefore the undefined behaviour. Casting the value to size_t before addition fixes the behaviour. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2019-05-29Merge branch 'ticket30561_029' into ticket30561_035Nick Mathewson
2019-01-16Bump copyright date to 2019.Nick Mathewson
2018-07-17Increase line coverage in libtor-string to 100%Nick Mathewson
(On linux.)
2018-07-10Rename util_malloc to malloc.Nick Mathewson
2018-07-10File-level summary documentation for src/lib/*/*.[ch]Nick Mathewson
2018-06-22Extract key string manipulation functions into a new library.Nick Mathewson