diff options
| author | Nat Goodspeed <nat@lindenlab.com> | 2023-10-17 06:33:05 -0400 |
|---|---|---|
| committer | Nat Goodspeed <nat@lindenlab.com> | 2023-10-17 06:33:05 -0400 |
| commit | 117f07e5a4b7882a44681c730dcc0628238cfec6 (patch) | |
| tree | 5cf60970252ad671fdd352062ae41950f318a82b /indra/newview/llxmlrpctransaction.cpp | |
| parent | 19f453fc2007f780ae5d819090db206f07d0a9c6 (diff) | |
SL-18837: Avoid stuffing build number into 32-bit int.
Even though LLVersionInfo::getBuild() already returns a 64-bit int, various
consumers assumed it could fit into 32 bits. It was especially bad to pass it
to a classic C style varargs function. Only on a little-endian CPU, and only
because it was the last argument, the damage was limited to truncation --
instead of arbitrary undefined behavior.
Where the consumer doesn't support 64-bit ints, pass as string instead.
Diffstat (limited to 'indra/newview/llxmlrpctransaction.cpp')
| -rw-r--r-- | indra/newview/llxmlrpctransaction.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp index b851b7ad5c..8ea07fcee0 100644 --- a/indra/newview/llxmlrpctransaction.cpp +++ b/indra/newview/llxmlrpctransaction.cpp @@ -42,6 +42,7 @@ #include "bufferarray.h" #include "llversioninfo.h" #include "llviewercontrol.h" +#include "stringize.h" // Have to include these last to avoid queue redefinition! @@ -384,14 +385,14 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip, const httpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_TEXT_XML); - std::string user_agent = llformat("%s %d.%d.%d (%ld)", - LLVersionInfo::instance().getChannel().c_str(), - LLVersionInfo::instance().getMajor(), - LLVersionInfo::instance().getMinor(), - LLVersionInfo::instance().getPatch(), - LLVersionInfo::instance().getBuild()); + std::string user_agent = stringize( + LLVersionInfo::instance().getChannel(), ' ', + LLVersionInfo::instance().getMajor(), '.', + LLVersionInfo::instance().getMinor(), '.', + LLVersionInfo::instance().getPatch(), " (", + LLVersionInfo::instance().getBuild(), ')'); - httpHeaders->append(HTTP_OUT_HEADER_USER_AGENT, user_agent); + httpHeaders->append(HTTP_OUT_HEADER_USER_AGENT, user_agent); ///* Setting the DNS cache timeout to -1 disables it completely. //This might help with bug #503 */ |
