jpcsupplies / Economy_mod

Basic Economy System for Space Engineers
13 stars 12 forks source link

BUG - anticipated bug - pay command may allow -negative payments which will steal from players #16

Closed jpcsupplies closed 9 years ago

jpcsupplies commented 9 years ago

looking over my code, if it works i can see a mathematical exploit where if a player types

/pay bob -100 hahaha i just stole all your money

it will actually take their money.

Suggested remedy: 1: check if player is admin... then allow them to steal it! 2: if they are not an admin, convert it to a string, remove the - then convert back to a decimal so the payment they tried to steal actually gets paid instead.. serve them right! 3: or just put in a if (messageText.StartsWith("-", StringComparison.InvariantCultureIgnoreCase) and halt with an error if we want to be boring.

midspace commented 9 years ago

value = Math.Abs(value);

jpcsupplies commented 9 years ago

ah yes nifty, i still want the admin functionality tho, so ill throw something together later while i am at work..

jpcsupplies commented 9 years ago

Fixed in f6d29de