]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Bojan Smojver <bojan@rexursive.com>
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 23 May 2008 06:28:32 +0000 (18:28 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 23 May 2008 06:28:32 +0000 (18:28 +1200)
Bug 2350: Memory allocation problem in restoreCapabilities(), tools.cc

Part 2 - Kernel folks are suggesting that the code in tools.cc should test
         _LINUX_CAPABILITY_VERSION_1 where possible

src/tools.cc

index 178994eaf24686e46901833af4ba9fb016de42ca..838b39c57a2f34ebb13a3992c012b34af8d8652d 100644 (file)
@@ -1262,14 +1262,22 @@ restoreCapabilities(int keep)
     cap_user_header_t head = (cap_user_header_t) xcalloc(1, sizeof(*head));
     cap_user_data_t cap = (cap_user_data_t) xcalloc(1, sizeof(*cap));
 
+#ifdef  _LINUX_CAPABILITY_VERSION_1
+    head->version = _LINUX_CAPABILITY_VERSION_1;
+#else
     head->version = _LINUX_CAPABILITY_VERSION;
+#endif
 
     if (capget(head, cap) != 0) {
         debugs(50, 1, "Can't get current capabilities");
         goto nocap;
     }
 
+#ifdef  _LINUX_CAPABILITY_VERSION_1
+    if (head->version != _LINUX_CAPABILITY_VERSION_1) {
+#else
     if (head->version != _LINUX_CAPABILITY_VERSION) {
+#endif
         debugs(50, 1, "Invalid capability version " << head->version << " (expected " << _LINUX_CAPABILITY_VERSION << ")");
         goto nocap;
     }