Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9652e76

Browse files
author
psyvisions
committed
Check for invalid characters when base58-decoding.
1 parent d3705db commit 9652e76

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/bitcoin.inc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ class Bitcoin {
7878
private function decodeBase58($base58) {
7979
$origbase58 = $base58;
8080

81+
//only valid chars allowed
82+
if (preg_match('/[^1-9A-HJ-NP-Za-km-z]/', $base58)) {
83+
return "";
84+
}
85+
8186
$return = "0";
8287
for ($i = 0; $i < strlen($base58); $i++) {
8388
$current = (string) strpos(Bitcoin::$base58chars, $base58[$i]);

0 commit comments

Comments
 (0)