当前位置:网站首页>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]);
边栏推荐
- [ismb2022 tutorial] the picture shows the precision medicine of learning. Marinka zitnik, Harvard University, keynote speaker, with 87 ppt
- 软件客户端数字签名一定要申请代码签名证书吗?
- 九齐单片机NY8B062D单按键控制4种LED状态
- Win11共享文件打不开怎么办?Win11共享文件打不开的解决方法
- C server log module
- 栈:如何实现有效括号的判断?
- Six stones programming: about code, there are six triumphs
- Flet教程之 04 FilledTonalButton基础入门(教程含源码)
- 如何让你的小游戏适配不同尺寸的手机屏幕
- Selected review | machine learning technology for Cataract Classification / classification
猜你喜欢
Win11系统wifi总掉线怎么办?Win11系统wifi总掉线的解决方法
什么叫内卷?
C server log module
QT writing the Internet of things management platform 38- multiple database support
How does win11 search for wireless displays? Win11 method of finding wireless display device
Selected review | machine learning technology for Cataract Classification / classification
Qt编写物联网管理平台38-多种数据库支持
What is involution?
Installation and use of VMware Tools and open VM tools: solve the problems of incomplete screen and unable to transfer files of virtual machines
关于联邦学习和激励的相关概念(1)
随机推荐
栈:如何实现有效括号的判断?
Lingyun going to sea | 10 jump &huawei cloud: jointly help Africa's inclusive financial services
idea大小写快捷键
左右最值最大差问题
什么是区块哈希竞猜游戏系统开发?哈希竞猜游戏系统开发(案例成熟)
更强的 JsonPath 兼容性及性能测试之2022版(Snack3,Fastjson2,jayway.jsonpath)
如何让你的小游戏适配不同尺寸的手机屏幕
js 闭包
What does the neural network Internet of things mean? Popular explanation
QT writing the Internet of things management platform 38- multiple database support
记录线上bug解决list(未完待续7/4)
What if the win11 shared file cannot be opened? The solution of win11 shared file cannot be opened
Write it down once Net analysis of thread burst height of an industrial control data acquisition platform
字节测试工程师十年经验直击UI 自动化测试痛点
NLP、视觉、芯片...AI重点方向发展几何?青源会展望报告发布[附下载]
Six stones programming: about code, there are six triumphs
What if the brightness of win11 is locked? Solution to win11 brightness locking
idea恢复默认快捷键
E-week finance | Q1 the number of active people in the insurance industry was 86.8867 million, and the licenses of 19 Payment institutions were cancelled
《动手学深度学习》(三) -- 卷积神经网络 CNN