Project-Diablo-2 / BH

A modified version of slashdiablo's BH for Project Diablo 2
GNU Affero General Public License v3.0
23 stars 20 forks source link

%AMED% have a problam with "ED" string #54

Open weili0677 opened 2 months ago

weili0677 commented 2 months ago

the bug line is: https://github.com/Project-Diablo-2/BH/blob/515ae38ce1addfbe035328cfd2eb0a91a9696446/BH/Modules/Item/ItemDisplay.cpp#L1327

in the loot.filter: if write "%AMED%ED" ,the source code "ItemDisplay.cpp#L1327" will dead loop.because %AMED% will replace to "AM" and "AM" + "ED" = "AMED" too,and will loop again to replace AMED to AMED

weili0677 commented 2 months ago

while (varString.find(replacements[n].key) != string::npos) Edit to: while (varString.length()==replacements[n].key.length()&&varString.find(replacements[n].key) != string::npos) will fix this issues

https://github.com/Project-Diablo-2/BH/blob/515ae38ce1addfbe035328cfd2eb0a91a9696446/BH/Modules/Item/ItemDisplay.cpp#L1325