monero-integrations / monerophp

Monero PHP library + JsonRPC Client
MIT License
118 stars 76 forks source link

Input validation in several functions not working #105

Closed jorgeelmundoso closed 4 years ago

jorgeelmundoso commented 4 years ago

https://github.com/monero-integrations/monerophp/blob/68900c3a8699aa24083cb9d05e3f492c99e07d4d/src/base58.php#L181-L185

please see

http://sandbox.onlinephpfunctions.com/code/bbb3f59200711389962f0860e7df3b826a810c4b

Your input validation is always true, so you don't catch unwanted types.

use https://www.php.net/manual/en/function.is-float.php and https://www.php.net/manual/en/function.is-int.php

serhack commented 4 years ago

Thanks! I'll commit a fix soon!

jorgeelmundoso commented 4 years ago

https://github.com/monero-integrations/monerophp/blob/aa7aea745f7b86e468dc9d2a75abb4ecbc305145/src/base58.php#L374-L393

isn't haystack supposed to be an array here ?

jorgeelmundoso commented 4 years ago

And maybe add a small test.