summaryrefslogtreecommitdiff
path: root/tests/test_header_only_1.cpp
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-06-15 23:35:20 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-06-15 23:35:20 -0700
commit95f013ba80fbe5a6c7423771d9c7715397f7585d (patch)
tree86c3dd5f6d03528df507e5937df469d02cba66e7 /tests/test_header_only_1.cpp
parent207bc788e93a40460c36bfbb9f2af9927b87de9b (diff)
Refactor snprintf support
Instead of branching code at each invocation site, use variadic macros to create a wrapping macro that use snprintf for the buffer of a statically known size. Variadic macros are supported by all C++11 compilers, as is snprintf; on MSVC 2005+ we don't necessarily have snprintf, but we can use _snprintf_s with _TRUNCATE to get the same behavior. In all other cases we fall back to sprintf, that (theoretically) can lead to a stack buffer overflow. In practice all snprintfs used in pugixml use buffers that should be large enough to never be overflown but snprintf is safe even if this is not the case.
Diffstat (limited to 'tests/test_header_only_1.cpp')
0 files changed, 0 insertions, 0 deletions