Permalink
Browse files

fixed some overflow warnings

  • Loading branch information...
1 parent 2601775 commit e5c07cbd253dc8ee61dd64a45b22daf9f3a2e951 @cruppstahl cruppstahl committed Nov 8, 2011
Showing with 2 additions and 3 deletions.
  1. +2 −3 unittests/util.cpp
View
@@ -118,7 +118,6 @@ class UtilTest : public hamsterDB_fixture
key_set_ptr(&src, 0x12345);
key_set_size(&src, 0);
key_set_flags(&src, 0);
- src._key[0]=0;
BFC_ASSERT_EQUAL(0, util_copy_key_int2pub(m_db, &src, &dest));
BFC_ASSERT_EQUAL(0, dest.size);
@@ -153,7 +152,7 @@ class UtilTest : public hamsterDB_fixture
key_set_ptr(src, 0x12345);
key_set_size(src, 8);
key_set_flags(src, 0);
- ::strcpy((char *)src->_key, "1234567\0");
+ ::memcpy((char *)src->_key, "1234567\0", 8);
BFC_ASSERT_EQUAL(0, util_copy_key_int2pub(m_db, src, &dest));
BFC_ASSERT_EQUAL(dest.size, key_get_size(src));
@@ -171,7 +170,7 @@ class UtilTest : public hamsterDB_fixture
key_set_ptr(src, 0x12345);
key_set_size(src, 16);
key_set_flags(src, 0);
- ::strcpy((char *)src->_key, "123456781234567\0");
+ ::strcpy((char *)&buffer[11] /*src->_key*/, "123456781234567\0");
BFC_ASSERT_EQUAL(0, util_copy_key_int2pub(m_db, src, &dest));
BFC_ASSERT_EQUAL(dest.size, key_get_size(src));

0 comments on commit e5c07cb

Please sign in to comment.