Luohuayu / CatServer

高性能和高兼容性的1.12.2/1.16.5/1.18.2版本Forge+Bukkit+Spigot服务端 (A high performance and high compatibility 1.12.2/1.16.5/1.18.2 version Forge+Bukkit+Spigot server)
https://catmc.org
GNU Lesser General Public License v3.0
1.98k stars 211 forks source link

log4j's formatMsgNoLookups is probably ineffective in 1.12.2. #380

Closed Narazaka closed 2 years ago

Narazaka commented 2 years ago

https://github.com/Luohuayu/CatServer/commit/50610c7879d927e1d3963c5a08ebe13c826c8d6e

The formatMsgNoLookups global option was added in log4j 2.10, but minecraft 1.12.2 uses log4j 2.8, so the fix may have no effect.

log4j formatMsgNoLookups commit: https://github.com/apache/logging-log4j2/commit/dd18e9b21009055e226daf5b233c92b6a17934ca

However, %msg{nolookups} seems to work for 2.8 as well.

%msg{nolookups} exists in 2.8: https://github.com/apache/logging-log4j2/blob/rel/2.8/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/MessagePatternConverter.java

cf. mohist 1.12.2 fix commit: https://github.com/MohistMC/Mohist/commit/cf2bdd4639cd75397011338450a317c2fedd2c13

Heriptik commented 2 years ago

Yes, the catserver patch don't work if i tape : say ${date:YYYY}

This return 2021 )=

Luohuayu commented 2 years ago

https://github.com/Luohuayu/CatServer/blob/1.12.2/src/main/java/catserver/server/utils/Log4j2_3201_Fixer.java Here is another patch to fix jndi. I think ${date:YYYY} is not threatening, and useless patch have been reverted.