Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Add extra protection for util.buffer strings
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasjpaterno committed Feb 13, 2020
1 parent a57de4a commit 85645e5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/utils/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,11 @@ function initData(tx, data) {
const keys = Object.keys(data);
tx._fields.forEach(function(field) {
if (keys.indexOf(field) !== -1) {
const val = data[field];
self[field] = val === "" ? "0x" : val;
let val = data[field];
if (typeof val === "string" && !val.startsWith("0x")) {
val = "0x" + val;
}
self[field] = val;
}
if (field === "gasLimit") {
if (keys.indexOf("gas") !== -1) {
Expand Down

0 comments on commit 85645e5

Please sign in to comment.