Now handling zeros in address correctly

This commit is contained in:
John Jones 2017-04-13 09:29:44 -05:00
parent 4cbcf6be3d
commit c96c1db14c
2 changed files with 5 additions and 7 deletions

View file

@ -124,8 +124,10 @@ int test_multiaddr_bytes() {
result = multiaddress_new_from_bytes(orig->bytes, orig->bsize); result = multiaddress_new_from_bytes(orig->bytes, orig->bsize);
if (strcmp(orig_address, result->string) != 0) if (strcmp(orig_address, result->string) != 0) {
fprintf(stderr, "%s does not equal %s\n", orig_address, result->string);
goto exit; goto exit;
}
retVal = 1; retVal = 1;
exit: exit:

View file

@ -97,12 +97,8 @@ void vthconvert(int size, char * crrz01, const uint8_t * xbuf)
int i; int i;
for(i=0; i < (size*2); i++) for(i=0; i < (size*2); i++)
{ {
if(buf[i]!='\0') sprintf (conv_proc, "%02X", buf[i]);
{ strcat(crrz1, conv_proc);
sprintf (conv_proc, "%02X", buf[i]);
//printf("%d:%d\n",i, buf[i]);
strcat(crrz1, conv_proc);
}
} }
crrz1 = NULL; crrz1 = NULL;
} }