The following fix addresses an uninitialized variable that can cause a problem
as well as making sure that addresses passed to mlock and munlock are correctly
aligned.

-Wyllys Ingersoll


--- src/tspi/tsp_policy.c.orig  Mon Aug  3 20:12:36 2009
+++ src/tspi/tsp_policy.c       Tue Oct 27 12:21:10 2009
@@ -43,7 +43,7 @@
  {
         BYTE secret[UI_MAX_SECRET_STRING_LENGTH] = { 0 };
         BYTE *dflt = (BYTE *)"TSS Authentication Dialog";
-       UINT32 secret_len;
+       UINT32 secret_len = 0;
         TSS_RESULT result;

         if (popup_str == NULL)
@@ -87,6 +87,8 @@
                 LogWarn("Not pinning secrets in memory due to insufficient 
perms.");
                 return 0;
         }
+       len += (uintptr_t)addr & PAGEOFFSET;
+        addr = (void *)((uintptr_t)addr & PAGEMASK);

         if (mlock(addr, len) == -1) {
                 LogError("mlock: %s", strerror(errno));
@@ -104,6 +106,8 @@
         if (getuid() != (uid_t)0) {
                 return 0;
         }
+        len += (uintptr_t)addr & PAGEOFFSET;
+        addr = (void *)((uintptr_t)addr & PAGEMASK);

         if (munlock(addr, len) == -1) {
                 LogError("mlock: %s", strerror(errno));


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
TrouSerS-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/trousers-tech

Reply via email to