diff --git a/src/util/buffer.h b/src/util/buffer.h
index 1467e64df..55ab43ec3 100644
--- a/src/util/buffer.h
+++ b/src/util/buffer.h
@@ -231,8 +231,13 @@ public:
         SASSERT(size() == nsz);
     }
 
-private:
-    buffer& operator=(buffer const&);
+    buffer & operator=(buffer const & other) {
+        if (this == &other)
+            return *this;
+        reset();
+        append(other);
+        return *this;
+    }
 };
 
 template<typename T, unsigned INITIAL_SIZE=16>
diff --git a/src/util/util.h b/src/util/util.h
index 945d259f9..3360c2282 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -243,6 +243,10 @@ public:
         m_ptr = 0;
         return tmp;
     }
+
+    void swap(scoped_ptr & p) {
+        std::swap(m_ptr, p.m_ptr);
+    }
 };
 
 template<typename T1, typename T2>