mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-29 22:55:52 +08:00
防止可能内存越界的问题
This commit is contained in:
parent
4c1f7babad
commit
837597e162
@ -35,8 +35,8 @@ bool getAVCInfo(const string &strSps, int &iVideoWidth, int &iVideoHeight, float
|
|||||||
return getAVCInfo(strSps.data(), strSps.size(), iVideoWidth, iVideoHeight, iVideoFps);
|
return getAVCInfo(strSps.data(), strSps.size(), iVideoWidth, iVideoHeight, iVideoFps);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *memfind(const char *buf, size_t len, const char *subbuf, size_t sublen) {
|
static const char *memfind(const char *buf, ssize_t len, const char *subbuf, ssize_t sublen) {
|
||||||
for (ssize_t i = 0; i < (ssize_t)(len - sublen); ++i) {
|
for (auto i = 0; i < len - sublen; ++i) {
|
||||||
if (memcmp(buf + i, subbuf, sublen) == 0) {
|
if (memcmp(buf + i, subbuf, sublen) == 0) {
|
||||||
return buf + i;
|
return buf + i;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user