From 78df239a9c5f11c68bbd46385041121e75d2f40e Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 24 Jan 2016 20:29:15 -0300 Subject: [PATCH] test --- iguana/SuperNET.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/iguana/SuperNET.c b/iguana/SuperNET.c index 5ffda3d78..d3af8d289 100644 --- a/iguana/SuperNET.c +++ b/iguana/SuperNET.c @@ -112,7 +112,7 @@ void SuperNET_myipaddr(struct supernet_info *myinfo,struct iguana_info *coin,str expand_ipbits(myinfo->ipaddr,myinfo->myaddr.selfipbits); vcalc_sha256(0,myinfo->myaddr.iphash.bytes,(uint8_t *)&myinfo->myaddr.selfipbits,sizeof(myinfo->myaddr.selfipbits)); } - if ( strcmp(myinfo->ipaddr,"127.0.0.1") == 0 ) + if ( myinfo->ipaddr[0] == 0 || strcmp(myinfo->ipaddr,"127.0.0.1") == 0 ) { strcpy(myinfo->ipaddr,myipaddr); } @@ -400,7 +400,10 @@ cJSON *SuperNET_bits2json(uint8_t *serialized,int32_t datalen) char *SuperNET_hexconv(char *hexmsg) { cJSON *json; char *myip,*yourip,*retstr = hexmsg; uint32_t myipbits=0,destipbits=0; - uint8_t *bits; int32_t n,len = (int32_t)strlen(hexmsg) >> 1; + uint8_t *bits; int32_t n,len = (int32_t)strlen(hexmsg); + if ( hexmsg == 0 || is_hexstr(hexmsg,len) == 0 ) + return(hexmsg); + len >>= 1; if ( (bits= calloc(1,len)) != 0 ) { decode_hex(bits,len,hexmsg);