Prat 3.0

633 - [Patch] Fix /target taint bug (updated version)

What does the provided patch do?

Long story short: insecurely hooking into SetItemRef is a bad idea as it will cause tainting with /target. Details can be found here: http://forums.wowace.com/showthread.php?p=323068

Here is an updated version that should work this time, making use of ItemRefTooltip:SetHyperlink instead.

--- Prat-3.0/addon/addon.lua	2012-08-28 20:35:02.000000000 -0400
+++ Prat-3.0/addon/addon.lua	2012-09-24 05:34:22.604313000 -0400
@@ -450,7 +450,7 @@
   end
 
   -- ItemRef Hooking
-  self:RawHook("SetItemRef", true)
+  --self:RawHook("SetItemRef", true)
 
 
   self:SecureHook("FCF_SetTemporaryWindowType")
@@ -500,9 +500,9 @@
   end
 end
 
-function addon:SetItemRef(...)
-  return SetItemRefHook(self.hooks.SetItemRef, ...)
-end
+--function addon:SetItemRef(...)
+--  return SetItemRefHook(self.hooks.SetItemRef, ...)
+--end
 
 
 function addon:ChatEdit_ParseText(editBox, send)

--- Prat-3.0/services/links.lua	2012-08-28 20:35:02.000000000 -0400
+++ Prat-3.0/services/links.lua	2012-09-24 05:47:45.106213500 -0400
@@ -85,18 +85,32 @@
     tremove(LinkRegistry, idx)
   end
 
-  function SetItemRefHook(orgfunc, link, ...)
+  local orgSetHyperlink = _G.ItemRefTooltip.SetHyperlink
+  function _G.ItemRefTooltip:SetHyperlink(link, ...)
     debug([[DUMP_LINK("SetItemRef ", link, ...)]])
+    if link then
     for i,reg_link in ipairs(LinkRegistry) do
       if reg_link.linkid == link:sub(1, (reg_link.linkid):len()) then
         if (reg_link.linkfunc(reg_link.handler, link, ...) == false) then
           debug([[DUMP_LINK("SetItemRef ", "Link Handled Internally")]])
-          return false
+            return
         end
       end
     end
-    orgfunc(link, ...)
   end
+    orgSetHyperlink(self, link, ...)
 end
 
+  local orgHandleModifiedItemClick = _G.HandleModifiedItemClick
+  function _G.HandleModifiedItemClick(link, ...)
+    if link then
+      for i,reg_link in ipairs(LinkRegistry) do
+        if reg_link.linkid == link:sub(1, (reg_link.linkid):len()) then
+          return
+        end
+      end
+    end
+    return orgHandleModifiedItemClick(link, ...)
+  end
 
+end
User When Change
Expf Oct 07, 2012 at 11:40 UTC Create

You must login to post a comment. Don't have an account? Register to get one!

Facts

Reported
Oct 07, 2012
Status
New - Issue has not had initial review yet.
Type
Patch - Source code patch for review
Priority
Medium - Normal priority.
Votes
0
Component
Prat Core

Reported by

Possible assignees