File tree Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -230,18 +230,20 @@ bool tostring256(const uint256_t *const number,
230
230
UPPER (LOWER (base )) = 0 ;
231
231
LOWER (LOWER (base )) = baseParam ;
232
232
uint32_t offset = 0 ;
233
- if ((baseParam < 2 ) || (baseParam > 16 )) {
233
+ if ((outLength == 0 ) || ( baseParam < 2 ) || (baseParam > 16 )) {
234
234
return false;
235
235
}
236
236
do {
237
- if (offset > (outLength - 1 )) {
238
- return false;
239
- }
240
237
divmod256 (& rDiv , & base , & rDiv , & rMod );
241
238
out [offset ++ ] = HEXDIGITS [(uint8_t ) LOWER (LOWER (rMod ))];
242
- } while (!zero256 (& rDiv ));
239
+ } while (!zero256 (& rDiv ) && ( offset < outLength ) );
243
240
244
- if (offset > (outLength - 1 )) {
241
+ if (offset == outLength ) { // destination buffer too small
242
+ if (outLength > 3 ) {
243
+ strcpy (out , "..." );
244
+ } else {
245
+ out [0 ] = '\0' ;
246
+ }
245
247
return false;
246
248
}
247
249
Original file line number Diff line number Diff line change @@ -619,7 +619,7 @@ def test_sign_blind_and_nonce_display(cmd):
619
619
620
620
transaction = Transaction (
621
621
txType = 0xEB ,
622
- nonce = 2 ** 64 - 1 ,
622
+ nonce = 1844674 ,
623
623
gasPrice = 0x0306dc4200 ,
624
624
gasLimit = 0x5208 ,
625
625
to = "0x5a321744667052affa8386ed49e00ef223cbffc3" ,
@@ -699,6 +699,6 @@ def test_sign_blind_and_nonce_display(cmd):
699
699
700
700
v , r , s = result
701
701
702
- assert v == 0x25 # 37
703
- assert r .hex () == "737c07042022d37286216312d62163c4238536d82c5b45937ce9fbf259d11b7d "
704
- assert s .hex () == "5604485e0cf37e465a84290eb26a18e40a430f1b0fda184c56b2c3a51ada2e6c "
702
+ assert v == 0x26 # 38
703
+ assert r .hex () == "c8d7cd5c1711ea1af7da048d15d1a95fc9347d4622afa11f32320d73384984d1 "
704
+ assert s .hex () == "3165ca0a27f565e1a87560ed3d3a144c4ac9732370428da5e6952e93659f6ac2 "
You can’t perform that action at this time.
0 commit comments