Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update asyncrt_utils.cpp to fix build failure with gcc-8 #814

Closed
wants to merge 1 commit into from

Conversation

LocutusOfBorg
Copy link
Contributor

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

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
@LocutusOfBorg
Copy link
Contributor Author

probably a better fix is #787

@LocutusOfBorg LocutusOfBorg deleted the patch-5 branch July 23, 2018 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant