From af64ea9ea13aea21feb09a2f2070da4421484623 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 11 Jun 2017 14:45:01 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_forwarding.c | 2 +- iguana/exchanges/LP_nativeDEX.c | 2 +- iguana/exchanges/LP_rpc.c | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_forwarding.c b/iguana/exchanges/LP_forwarding.c index aea5d91e9..69163f4f7 100644 --- a/iguana/exchanges/LP_forwarding.c +++ b/iguana/exchanges/LP_forwarding.c @@ -49,7 +49,7 @@ char *LP_lookup(bits256 pubkey) char *LP_register(bits256 pubkey,char *pushaddr) { struct LP_forwardinfo *ptr=0; int32_t pushsock; - if ( is_ipaddr(pushaddr+strlen("tcp://")) == 0 ) + if ( strlen(pushaddr) <= strlen("tcp://") || is_ipaddr(pushaddr+strlen("tcp://")) == 0 ) return(clonestr("{\"error\":\"illegal ipaddr\"}")); if ( (ptr= LP_forwardfind(pubkey)) != 0 ) { diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 426aad3ce..fc533884a 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -225,7 +225,7 @@ void LP_mainloop(char *myipaddr,struct LP_peerinfo *mypeer,uint16_t mypubport,in LP_utxosquery(mypeer,pubsock,peer->ipaddr,peer->port,"",100,mypeer != 0 ? mypeer->ipaddr : "127.0.0.1",myport,profitmargin); } } - printf("mainloop\n"); + printf("mainloop pushaddr.(%s)\n",pushaddr); if ( IAMLP == 0 ) { while ( 1 ) diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index b7e682280..b489a8c51 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -61,6 +61,8 @@ char *issue_LP_notifyutxo(char *destip,uint16_t destport,struct LP_utxoinfo *utx char *issue_LP_register(char *destip,uint16_t destport,bits256 pubkey,char *pushaddr) { char url[512],str[65]; + if ( strncmp("tcp://",pushaddr,strlen("tcp://")) != 0 || strlen(pushaddr) <= strlen("tcp://") ) + return(clonestr("{\"error\":\"illegal pushaddr\"}")); sprintf(url,"http://%s:%u/api/stats/register?pubkey=%s&pushaddr=%s",destip,destport,bits256_str(str,pubkey),pushaddr); //printf("getutxo.(%s)\n",url); return(issue_curl(url));