You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by mi...@apache.org on 2012/05/03 04:06:02 UTC
svn commit: r1333290 - in /zookeeper/branches/branch-3.3: CHANGES.txt
src/c/src/zookeeper.c src/c/tests/TestClient.cc
Author: michim
Date: Thu May 3 02:06:02 2012
New Revision: 1333290
URL: http://svn.apache.org/viewvc?rev=1333290&view=rev
Log:
ZOOKEEPER-1305. zookeeper.c:prepend_string func can dereference null ptr (Daniel Lescohier via michim)
Modified:
zookeeper/branches/branch-3.3/CHANGES.txt
zookeeper/branches/branch-3.3/src/c/src/zookeeper.c
zookeeper/branches/branch-3.3/src/c/tests/TestClient.cc
Modified: zookeeper/branches/branch-3.3/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.3/CHANGES.txt?rev=1333290&r1=1333289&r2=1333290&view=diff
==============================================================================
--- zookeeper/branches/branch-3.3/CHANGES.txt (original)
+++ zookeeper/branches/branch-3.3/CHANGES.txt Thu May 3 02:06:02 2012
@@ -11,6 +11,8 @@ BUGFIXES:
ZOOKEEPER-1450. Backport of ZOOKEEPER-1294 fix to 3.4 and 3.3 (Norman Bishop via camille)
+ ZOOKEEPER-1305. zookeeper.c:prepend_string func can dereference null ptr (Daniel Lescohier via michim)
+
Release 3.3.5 - 2012-03-18
Backward compatible changes:
Modified: zookeeper/branches/branch-3.3/src/c/src/zookeeper.c
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.3/src/c/src/zookeeper.c?rev=1333290&r1=1333289&r2=1333290&view=diff
==============================================================================
--- zookeeper/branches/branch-3.3/src/c/src/zookeeper.c (original)
+++ zookeeper/branches/branch-3.3/src/c/src/zookeeper.c Thu May 3 02:06:02 2012
@@ -818,7 +818,7 @@ void free_duplicate_path(const char *fre
*/
static char* prepend_string(zhandle_t *zh, const char* client_path) {
char *ret_str;
- if (zh->chroot == NULL)
+ if (zh == NULL || zh->chroot == NULL)
return (char *) client_path;
// handle the chroot itself, client_path = "/"
if (strlen(client_path) == 1) {
Modified: zookeeper/branches/branch-3.3/src/c/tests/TestClient.cc
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.3/src/c/tests/TestClient.cc?rev=1333290&r1=1333289&r2=1333290&view=diff
==============================================================================
--- zookeeper/branches/branch-3.3/src/c/tests/TestClient.cc (original)
+++ zookeeper/branches/branch-3.3/src/c/tests/TestClient.cc Thu May 3 02:06:02 2012
@@ -772,6 +772,10 @@ public:
zk_ch = createchClient(&ctx_ch, "127.0.0.1:22181/testch1/mahadev");
CPPUNIT_ASSERT(zk_ch != NULL);
zk = createClient(&ctx);
+ // first test with a NULL zk handle, make sure client library does not
+ // dereference a null pointer, but instead returns ZBADARGUMENTS
+ rc = zoo_create(NULL, "/testch1", "", 0, &ZOO_OPEN_ACL_UNSAFE, 0, 0, 0);
+ CPPUNIT_ASSERT_EQUAL((int) ZBADARGUMENTS, rc);
rc = zoo_create(zk, "/testch1", "", 0, &ZOO_OPEN_ACL_UNSAFE, 0, 0, 0);
CPPUNIT_ASSERT_EQUAL((int) ZOK, rc);
rc = zoo_create(zk, "/testch1/mahadev", data, 7, &ZOO_OPEN_ACL_UNSAFE, 0, 0, 0);