AlphaWallet / AlphaWallet/Web3E

Segfault in getString

未关闭
#21 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C
星标
152
派生
45
PR 合并指标
30 天内没有已合并 PR

描述

Trying to parse for example the following result results in a buffer underflow of lengthIndex.

```
{"jsonrpc":"2.0","id":0,"result":"0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000005468747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f6c6f72626b652f426c6f636b426f6172642f6d61696e2f6173736574732f64656661756c745f68617264776172652e676966000000000000000000000000"}
```
```
while (lengthIndex > 0)
{
Serial.println(index);
asciiHex += v->at(index++);
lengthIndex -= 32;
}
```

checking if lengthIndex is smaller than 32 before subtracting or changing lengthIndex to a signed int fixes the segfault

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。