diff --git a/gui/gui.pro b/gui/gui.pro index 9b9c73af9..2ac6ec09a 100644 --- a/gui/gui.pro +++ b/gui/gui.pro @@ -4,7 +4,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = gui TEMPLATE = app -SOURCES += ../bip32.c ../bip39.c ../sha2.c ../pbkdf2.c ../hmac.c ../rand.c ../bignum.c ../ecdsa.c ../ripemd160.c ../base58.c ../secp256k1.c mainwindow.cpp main.cpp +SOURCES += ../bip32.c ../bip39.c ../sha2.c ../pbkdf2.c ../hmac.c ../rand.c ../bignum.c ../ecdsa.c ../ripemd160.c ../base58.c ../secp256k1.c ../nist256p1.c mainwindow.cpp main.cpp HEADERS += mainwindow.h ../bip32.h ../bip39.h diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index b3a19296f..a67d28857 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -45,7 +45,8 @@ void MainWindow::on_spinAccount_valueChanged(int arg1) { if (!root_set) return; const char addr_version = 0x00, wif_version = 0x80; - char buf[128]; + const size_t buflen = 128; + char buf[buflen + 1]; HDNode node; // external chain for (int chain = 0; chain < 2; chain++) { @@ -54,14 +55,14 @@ void MainWindow::on_spinAccount_valueChanged(int arg1) hdnode_private_ckd(&node, 44 | 0x80000000); hdnode_private_ckd(&node, 0 | 0x80000000); // bitcoin hdnode_private_ckd(&node, (arg1 - 1) | 0x80000000); - hdnode_serialize_private(&node, buf); QString xprv = QString(buf); ui->lineXprv->setText(xprv); - hdnode_serialize_public(&node, buf); QString xpub = QString(buf); ui->lineXpub->setText(xpub); + hdnode_serialize_private(&node, buf, buflen); QString xprv = QString(buf); ui->lineXprv->setText(xprv); + hdnode_serialize_public(&node, buf, buflen); QString xpub = QString(buf); ui->lineXpub->setText(xpub); hdnode_private_ckd(&node, chain); // external / internal for (int i = 0; i < 100; i++) { HDNode node2 = node; hdnode_private_ckd(&node2, i); - ecdsa_get_address(node2.public_key, addr_version, buf); QString address = QString(buf); - ecdsa_get_wif(node2.private_key, wif_version, buf); QString wif = QString(buf); + ecdsa_get_address(node2.public_key, addr_version, buf, buflen); QString address = QString(buf); + ecdsa_get_wif(node2.private_key, wif_version, buf, buflen); QString wif = QString(buf); list->setItem(i, 0, new QTableWidgetItem(address)); list->setItem(i, 1, new QTableWidgetItem(wif)); list->setItem(i, 2, new QTableWidgetItem("0.0"));