diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2017-06-15 23:35:20 -0700 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2017-06-15 23:35:20 -0700 |
commit | 95f013ba80fbe5a6c7423771d9c7715397f7585d (patch) | |
tree | 86c3dd5f6d03528df507e5937df469d02cba66e7 /tests/test_xpath_paths_abbrev_w3c.cpp | |
parent | 207bc788e93a40460c36bfbb9f2af9927b87de9b (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_xpath_paths_abbrev_w3c.cpp')
0 files changed, 0 insertions, 0 deletions