projects
/
gssweb.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
01cef7a
)
Don't return pointers to memory held by local std::string buffers
author
Kevin Wasserman
<krwasserman@painless-security.com>
Thu, 20 Nov 2014 22:32:37 +0000
(17:32 -0500)
committer
Kevin Wasserman
<krwasserman@painless-security.com>
Thu, 20 Nov 2014 22:32:37 +0000
(17:32 -0500)
json_gssapi/test/GSSGetMicTest.cpp
patch
|
blob
|
history
json_gssapi/test/GSSPseudoRandomTest.cpp
patch
|
blob
|
history
json_gssapi/test/GSSUnwrapTest.cpp
patch
|
blob
|
history
json_gssapi/test/GSSWrapTest.cpp
patch
|
blob
|
history
diff --git
a/json_gssapi/test/GSSGetMicTest.cpp
b/json_gssapi/test/GSSGetMicTest.cpp
index
1273761
..
cb50fff
100644
(file)
--- a/
json_gssapi/test/GSSGetMicTest.cpp
+++ b/
json_gssapi/test/GSSGetMicTest.cpp
@@
-31,10
+31,8
@@
mock_get_mic(
{
/* Error checking */
/* Variables */
{
/* Error checking */
/* Variables */
- std::string buffer;
/* Setup */
/* Setup */
- buffer = MockGetMic::outputToken.toString();
/* Main */
// Copy our input from the appropriate parameters to MockGetMic
/* Main */
// Copy our input from the appropriate parameters to MockGetMic
@@
-45,8
+43,7
@@
mock_get_mic(
// copy our output to the appropriate parameters
*minor_status = MockGetMic::minor_status;
// copy our output to the appropriate parameters
*minor_status = MockGetMic::minor_status;
- message_token->length = buffer.length();
- message_token->value = (void *)buffer.c_str();
+ *message_token = *MockGetMic::outputToken.toGss();
/* Cleanup */
/* return */
/* Cleanup */
/* return */
diff --git
a/json_gssapi/test/GSSPseudoRandomTest.cpp
b/json_gssapi/test/GSSPseudoRandomTest.cpp
index
d28b8fd
..
93d123c
100644
(file)
--- a/
json_gssapi/test/GSSPseudoRandomTest.cpp
+++ b/
json_gssapi/test/GSSPseudoRandomTest.cpp
@@
-38,7
+38,6
@@
OM_uint32 mock_gss_pseudo_random(
gss_buffer_t prf_out)
{
/* Variables */
gss_buffer_t prf_out)
{
/* Variables */
- std::string buffer;
/* Error checking */
/* Setup */
/* Main */
/* Error checking */
/* Setup */
/* Main */
@@
-47,9
+46,7
@@
OM_uint32 mock_gss_pseudo_random(
MockPseudoRandom::inputMessageBuffer.setValue(prf_in);
MockPseudoRandom::desiredOutputLength = desired_output_len;
MockPseudoRandom::inputMessageBuffer.setValue(prf_in);
MockPseudoRandom::desiredOutputLength = desired_output_len;
- buffer = MockPseudoRandom::outputMessageBuffer.toString();
- prf_out->length = buffer.length();
- prf_out->value = (void *)buffer.c_str();
+ *prf_out = *MockPseudoRandom::outputMessageBuffer.toGss();
/* Cleanup */
/* Return */
/* Cleanup */
/* Return */
diff --git
a/json_gssapi/test/GSSUnwrapTest.cpp
b/json_gssapi/test/GSSUnwrapTest.cpp
index
de0d9a1
..
1ed079d
100644
(file)
--- a/
json_gssapi/test/GSSUnwrapTest.cpp
+++ b/
json_gssapi/test/GSSUnwrapTest.cpp
@@
-35,10
+35,8
@@
mock_unwrap(
{
/* Error checking */
/* Variables */
{
/* Error checking */
/* Variables */
- std::string buffer;
/* Setup */
/* Setup */
- buffer = MockUnwrap::outputMessageBuffer.toString();
/* Main */
// Copy our input from the appropriate parameters to MockUnwrap
/* Main */
// Copy our input from the appropriate parameters to MockUnwrap
@@
-50,8
+48,7
@@
mock_unwrap(
*minor_status = MockUnwrap::minor_status;
*conf_state = MockUnwrap::conf_state;
*qop_state = MockUnwrap::qop_state;
*minor_status = MockUnwrap::minor_status;
*conf_state = MockUnwrap::conf_state;
*qop_state = MockUnwrap::qop_state;
- output_message_buffer->length = buffer.length();
- output_message_buffer->value = (void *)buffer.c_str();
+ *output_message_buffer = *MockUnwrap::outputMessageBuffer.toGss();
/* Cleanup */
/* return */
/* Cleanup */
/* return */
diff --git
a/json_gssapi/test/GSSWrapTest.cpp
b/json_gssapi/test/GSSWrapTest.cpp
index
0f170e1
..
684dadb
100644
(file)
--- a/
json_gssapi/test/GSSWrapTest.cpp
+++ b/
json_gssapi/test/GSSWrapTest.cpp
@@
-33,10
+33,8
@@
mock_wrap(
{
/* Error checking */
/* Variables */
{
/* Error checking */
/* Variables */
- std::string buffer;
/* Setup */
/* Setup */
- buffer = MockWrap::outputMessageBuffer.toString();
/* Main */
// Copy our input from the appropriate parameters to MockWrap
/* Main */
// Copy our input from the appropriate parameters to MockWrap
@@
-49,8
+47,7
@@
mock_wrap(
// copy our output to the appropriate parameters
*minor_status = MockWrap::minor_status;
*conf_state = MockWrap::conf_state;
// copy our output to the appropriate parameters
*minor_status = MockWrap::minor_status;
*conf_state = MockWrap::conf_state;
- output_message_buffer->length = buffer.length();
- output_message_buffer->value = (void *)buffer.c_str();
+ *output_message_buffer = *MockWrap::outputMessageBuffer.toGss();
/* Cleanup */
/* return */
/* Cleanup */
/* return */