aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2011-04-29 16:59:29 +0000
committerlloyd <[email protected]>2011-04-29 16:59:29 +0000
commit93b5927837b75d9660084e83adf04c77a57fe4b3 (patch)
treee3946d10e67182cb5901a217ef1ccc90048b025e /src
parent96043ac4c4fdd4e7c23143097922843552b4aa9a (diff)
Calling &str[str.size()] is only valid if str is const; otherwise the
results are undefined. This happens to work under GCC and most other compilers, but does not under Visual C++ 2010. This broke hex_encode when encoding an empty input, and this subsequently broke SSL handshaking. 2010 includes a TR1 that works fine for SSL, but it puts the headers in the main header space rather than under tr1/, so account for that. Hack the socket header into working under WinSock Tick version to 1.10.0
Diffstat (limited to 'src')
-rw-r--r--src/codec/hex/hex.cpp9
-rw-r--r--src/ssl/tls_record.h8
2 files changed, 12 insertions, 5 deletions
diff --git a/src/codec/hex/hex.cpp b/src/codec/hex/hex.cpp
index 49d6e7190..41ba1298d 100644
--- a/src/codec/hex/hex.cpp
+++ b/src/codec/hex/hex.cpp
@@ -37,9 +37,7 @@ void hex_encode(char output[],
std::string hex_encode(const MemoryRegion<byte>& input,
bool uppercase)
{
- return hex_encode(&input[0],
- input.size(),
- uppercase);
+ return hex_encode(&input[0], input.size(), uppercase);
}
std::string hex_encode(const byte input[],
@@ -47,7 +45,10 @@ std::string hex_encode(const byte input[],
bool uppercase)
{
std::string output(2 * input_length, 0);
- hex_encode(&output[0], input, input_length, uppercase);
+
+ if(input_length)
+ hex_encode(&output[0], input, input_length, uppercase);
+
return output;
}
diff --git a/src/ssl/tls_record.h b/src/ssl/tls_record.h
index 7a223095f..09fd921c6 100644
--- a/src/ssl/tls_record.h
+++ b/src/ssl/tls_record.h
@@ -16,7 +16,13 @@
#include <vector>
#if defined(BOTAN_USE_STD_TR1)
- #include <tr1/functional>
+
+#if defined(BOTAN_BUILD_COMPILER_IS_MSVC)
+ #include <functional>
+#else
+ #include <tr1/functional>
+#endif
+
#elif defined(BOTAN_USE_BOOST_TR1)
#include <boost/tr1/functional.hpp>
#else