Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于解析path的内存错误 #67

Open
ruanryq421 opened this issue May 9, 2022 · 0 comments
Open

关于解析path的内存错误 #67

ruanryq421 opened this issue May 9, 2022 · 0 comments

Comments

@ruanryq421
Copy link

if(sscanf(url+7, "%[^:]:%hu/%s", ip, &port, suffix) == 3)
{

}
else if(sscanf(url+7, "%[^/]/%s", ip, suffix) == 2) {
	port = 554;
}
else {
	return false;
}

这段代码需要调换下顺序,==2在前面,==3在后面。应该是你那边没有模拟到这种情况,正常的工具是不会出现这种情况,如果给过来的path没有带端口,就要出现内存错误,换顺序后就可以解决了,原因是==3放在前面,如果path不带端口,那边ip里面会存在多个字符串(多个\0结尾),那边插入map的时候会存在内存错误

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant