]> 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:36:37 +0000 (18:36 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 23 May 2008 06:36:37 +0000 (18:36 +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 9b5d141a17492deff5cb96771150916a9e306470..2a136666cf338ffa039f0f8658816f315a78bc97 100644 (file)
@@ -1360,14 +1360,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;
     }