]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fixed IPC message size calculation typo that led to gardbage in messages.
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 30 Apr 2010 18:01:29 +0000 (12:01 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Fri, 30 Apr 2010 18:01:29 +0000 (12:01 -0600)
src/ipc/Messages.cc

index 5b0d585af83c922da439535bd815e803b6b1ffc7..99d9d9dd89521b7734499449f4b1f64dce197dab 100644 (file)
@@ -22,12 +22,12 @@ Ipc::StrandCoord::StrandCoord(int aKidId, pid_t aPid): kidId(aKidId), pid(aPid)
 
 Ipc::StrandCoord::StrandCoord(const TypedMsgHdr &hdrMsg): kidId(-1), pid(0)
 {
-    hdrMsg.getData(mtRegistration, this, sizeof(this));
+    hdrMsg.getData(mtRegistration, this, sizeof(*this));
 }
 
 void Ipc::StrandCoord::pack(TypedMsgHdr &hdrMsg) const
 {
-    hdrMsg.putData(mtRegistration, this, sizeof(this));
+    hdrMsg.putData(mtRegistration, this, sizeof(*this));
 }
 
 
@@ -42,10 +42,10 @@ Ipc::Descriptor::Descriptor(int aFromKid, int aFd): fromKid(aFromKid), fd(aFd)
 Ipc::Descriptor::Descriptor(const TypedMsgHdr &hdrMsg): fromKid(-1), fd(-1)
 {
     if (hdrMsg.type() == mtDescriptorGet) {
-        hdrMsg.getData(mtDescriptorGet, this, sizeof(this));
+        hdrMsg.getData(mtDescriptorGet, this, sizeof(*this));
         fd = -1;
     } else {
-        hdrMsg.getData(mtDescriptorPut, this, sizeof(this));
+        hdrMsg.getData(mtDescriptorPut, this, sizeof(*this));
         fd = hdrMsg.getFd();
     }
 }
@@ -53,9 +53,9 @@ Ipc::Descriptor::Descriptor(const TypedMsgHdr &hdrMsg): fromKid(-1), fd(-1)
 void Ipc::Descriptor::pack(TypedMsgHdr &hdrMsg) const
 {
     if (fd >= 0) {
-        hdrMsg.putData(mtDescriptorPut, this, sizeof(this));
+        hdrMsg.putData(mtDescriptorPut, this, sizeof(*this));
         hdrMsg.putFd(fd);
     } else {
-        hdrMsg.putData(mtDescriptorGet, this, sizeof(this));
+        hdrMsg.putData(mtDescriptorGet, this, sizeof(*this));
     }
 }