Update asyncrt_utils.cpp to fix build failure with gcc-8 #814
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
output size should at least equal to sizeof(datetime_str) + sizeof(buf)
/cpprest/Release/src/utilities/asyncrt_utils.cpp: In member function 'utility::string_t utility::datetime::to_string(utility::datetime::date_format) const':
/cpprest/Release/src/utilities/asyncrt_utils.cpp:702:42: error: '%s' directive output may be truncated writing up to 8 bytes into a region of size between 1 and 65 [-Werror=format-truncation=]
snprintf(output, sizeof(output), "%s%sZ", datetime_str, buf);
^~~~~~~ ~~~
In file included from /usr/include/stdio.h:862,
from /usr/include/c++/8/cstdio:42,
from /usr/include/c++/8/ext/string_conversions.h:43,
from /usr/include/c++/8/bits/basic_string.h:6391,
from /usr/include/c++/8/string:52,
from /cpprest/Release/src/pch/stdafx.h:50,
from /cpprest/Release/src/utilities/asyncrt_utils.cpp:14:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: '__builtin___snprintf_chk' output between 2 and 74 bytes into a destination of size 65
return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__bos (__s), __fmt, __va_arg_pack ());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors