当前位置:网站首页>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]);
边栏推荐
- Flet tutorial 04 basic introduction to filledtonalbutton (tutorial includes source code)
- 紫光展锐完成全球首个 5G R17 IoT NTN 卫星物联网上星实测
- 电脑怎么保存网页到桌面上使用
- 看腾讯大老如何做接口自动化测试
- QT writing the Internet of things management platform 38- multiple database support
- GVM使用
- js 闭包
- 凌云出海记 | 一零跃动&华为云:共助非洲普惠金融服务
- go笔记(1)go语言介绍以及特点
- jekins初始化密码没有或找不到
猜你喜欢

What is involution?
一文搞懂Go语言中文件的读写与创建

工厂从自动化到数字孪生,图扑能干什么?

Neural network IOT platform construction (IOT platform construction practical tutorial)

Flet tutorial 05 outlinedbutton basic introduction (tutorial includes source code)

FS4061A升压8.4V充电IC芯片和FS4061B升压12.6V充电IC芯片规格书datasheet
![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]
![[today in history] July 4: the first e-book came out; The inventor of magnetic stripe card was born; Palm computer pioneer was born](/img/0b/73f0d98a6db813e54074abe199ed98.png)
[today in history] July 4: the first e-book came out; The inventor of magnetic stripe card was born; Palm computer pioneer was born

Dynamic memory management

Employment prospects and current situation of Internet of things application technology
随机推荐
针对深度学习的“失忆症”,科学家提出基于相似性加权交错学习,登上PNAS
工厂从自动化到数字孪生,图扑能干什么?
剑指 Offer II 80-100(持续更新)
六石编程学:关于代码,有六个得意
更强的 JsonPath 兼容性及性能测试之2022版(Snack3,Fastjson2,jayway.jsonpath)
复杂因子计算优化案例:深度不平衡、买卖压力指标、波动率计算
阿里测试师用UI自动化测试实现元素定位
So this is the BGP agreement
NLP, vision, chip What is the development direction of AI? Release of the outlook report of Qingyuan Association [download attached]
How does the computer save web pages to the desktop for use
为什么最大速度是光速
Managed service network: application architecture evolution in the cloud native Era
电脑怎么保存网页到桌面上使用
Every time I look at the interface documents of my colleagues, I get confused and have a lot of problems...
Selected review | machine learning technology for Cataract Classification / classification
Flet教程之 06 TextButton基础入门(教程含源码)
Regular replacement [JS, regular expression]
How does win11 search for wireless displays? Win11 method of finding wireless display device
Detailed explanation of Audi EDI invoice message
【历史上的今天】7 月 4 日:第一本电子书问世;磁条卡的发明者出生;掌上电脑先驱诞生