当前位置:网站首页>Record the online bug solving list (unfinished to be continued 7/4)
Record the online bug solving list (unfinished to be continued 7/4)
2022-07-04 20:43:00 【Xie Baiyu】
List of articles
One 、sprintf Caused by memory out of bounds
A packet sent by the player client failed to unpack , But I don't know why , Therefore, a function is added to send the wrong data package with 16 Binary output to log Function of
char *buffer = calloc(sz*2+1, sizeof(char));
First allocate a piece of memory , The length is dump Data length of double plus one . Then the cycle
sprintf(buffer+i*2, "%02x", data[i]);
This is what we haven't noticed for several times bug Where :data yes const char type , The signed . When data[i] When it is a negative number , %02x Not necessarily only output 3 Bytes ( Don't forget the end of the string \0).buffer This memory is written out of bounds
problem
When the last character is negative Just crossed the line More than two characters Get the tail 0 It's covered So the question is ,solve
Change to snprintf or
sprintf(buffer+i*2, "%02x", (unsigned char)data[i]);
边栏推荐
- Win11亮度被锁定怎么办?Win11亮度被锁定的解决方法
- 栈:如何实现有效括号的判断?
- 1500万员工轻松管理,云原生数据库GaussDB让HR办公更高效
- Practice examples to understand JS strong cache negotiation cache
- ICML 2022 | Meta提出鲁棒的多目标贝叶斯优化方法,有效应对输入噪声
- 看腾讯大老如何做接口自动化测试
- What if the win11 shared file cannot be opened? The solution of win11 shared file cannot be opened
- Optimization cases of complex factor calculation: deep imbalance, buying and selling pressure index, volatility calculation
- Taishan Office Technology Lecture: about the order of background (shading and highlighting)
- node强缓存和协商缓存实战示例
猜你喜欢

Jiuqi ny8b062d MCU specification /datasheet
一文搞懂Go语言中文件的读写与创建

Win11无法将值写入注册表项如何解决?

FS8B711S14电动红酒开瓶器单片机IC方案开发专用集成IC

Every time I look at the interface documents of my colleagues, I get confused and have a lot of problems...

Process of manually encrypt the mass-producing firmware and programming ESP devices

Flet教程之 08 AppBar工具栏基础入门(教程含源码)

C # better operation mongodb database

二叉树的四种遍历方式以及中序后序、前序中序、前序后序、层序创建二叉树【专为力扣刷题而打造】
![NLP, vision, chip What is the development direction of AI? Release of the outlook report of Qingyuan Association [download attached]](/img/79/82763392e74d102921b4e8e601d4c6.png)
NLP, vision, chip What is the development direction of AI? Release of the outlook report of Qingyuan Association [download attached]
随机推荐
强化学习-学习笔记2 | 价值学习
Dynamic memory management
Hash quiz game system development how to develop hash quiz game system development (multiple cases)
Neural network IOT platform construction (IOT platform construction practical tutorial)
Template_ Large integer subtraction_ Regardless of size
How is the entered query SQL statement executed?
Lingyun going to sea | Murong Technology & Huawei cloud: creating a model of financial SaaS solutions in Africa
漫谈客户端存储技术之Cookie篇
How does win11 search for wireless displays? Win11 method of finding wireless display device
2022 Health Exhibition, Beijing Health Expo, China Health Exhibition, great health exhibition November 13
凌云出海记 | 文华在线&华为云:打造非洲智慧教学新方案
Flet教程之 04 FilledTonalButton基础入门(教程含源码)
【ISMB2022教程】图表示学习的精准医疗,哈佛大学Marinka Zitnik主讲,附87页ppt
Six stones programming: about code, there are six triumphs
What does the neural network Internet of things mean? Popular explanation
What if the win11 shared file cannot be opened? The solution of win11 shared file cannot be opened
FS8B711S14电动红酒开瓶器单片机IC方案开发专用集成IC
2022 version of stronger jsonpath compatibility and performance test (snack3, fastjson2, jayway.jsonpath)
Jiuqi ny8b062d MCU specification /datasheet
[ismb2022 tutorial] the picture shows the precision medicine of learning. Marinka zitnik, Harvard University, keynote speaker, with 87 ppt