The Wayback Machine - https://web.archive.org/web/20201201004601/https://github.com/microsoft/cpprestsdk/pull/814
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

@LocutusOfBorg LocutusOfBorg commented Jul 23, 2018

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

@LocutusOfBorg LocutusOfBorg commented Jul 23, 2018

probably a better fix is #787

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

Successfully merging this pull request may close these issues.

None yet

1 participant
You can’t perform that action at this time.