Skip to content

Commit

Permalink
buffer overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
boufni95 committed Dec 18, 2024
1 parent e055444 commit 2334aa8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/services/metrics/tlv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const utf8Encoder: TextEncoder = new TextEncoder()

export const usageMetricsToTlv = (metric: Types.UsageMetric): TLV => {
const tlv: TLV = {}
tlv[2] = [integerToUint8Array(metric.processed_at_ms)] // 6 -> 6
tlv[2] = [integerToUint8Array(metric.processed_at_ms / 1000)] // 6 -> 6
tlv[3] = [integerToUint8Array(metric.parsed_in_nano)] // 6 -> 12
tlv[4] = [integerToUint8Array(metric.auth_in_nano)] // 6 -> 18
tlv[5] = [integerToUint8Array(metric.validate_in_nano)] // 6 -> 24
Expand All @@ -20,7 +20,7 @@ export const usageMetricsToTlv = (metric: Types.UsageMetric): TLV => {
export const tlvToUsageMetrics = (rpcName: string, tlv: TLV): Types.UsageMetric => {
const metric: Types.UsageMetric = {
rpc_name: rpcName,
processed_at_ms: parseInt(bytesToHex(tlv[2][0]), 16),
processed_at_ms: parseInt(bytesToHex(tlv[2][0]), 16) * 1000,
parsed_in_nano: parseInt(bytesToHex(tlv[3][0]), 16),
auth_in_nano: parseInt(bytesToHex(tlv[4][0]), 16),
validate_in_nano: parseInt(bytesToHex(tlv[5][0]), 16),
Expand Down

0 comments on commit 2334aa8

Please sign in to comment.