提交 4e3d1f3f authored 作者: Jeff Lenk's avatar Jeff Lenk

windows mod_enum fix potential seg

上级 31580d66
...@@ -153,14 +153,12 @@ static switch_status_t load_config(void) ...@@ -153,14 +153,12 @@ static switch_status_t load_config(void)
"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters",
0, KEY_QUERY_VALUE, &hKey); 0, KEY_QUERY_VALUE, &hKey);
if (hKey) {
RegQueryValueEx(hKey, "DhcpNameServer", NULL, NULL, NULL, &data_sz); RegQueryValueEx(hKey, "DhcpNameServer", NULL, NULL, NULL, &data_sz);
if (globals.server) { if (data_sz) {
free(globals.server);
}
buf = (char*)malloc(data_sz + 1); buf = (char*)malloc(data_sz + 1);
RegQueryValueEx(hKey, "DhcpNameServer", NULL, NULL, (LPBYTE)buf, &data_sz); RegQueryValueEx(hKey, "DhcpNameServer", NULL, NULL, (LPBYTE)buf, &data_sz);
RegCloseKey(hKey); RegCloseKey(hKey);
if(buf[data_sz - 1] != 0) { if(buf[data_sz - 1] != 0) {
...@@ -168,6 +166,8 @@ static switch_status_t load_config(void) ...@@ -168,6 +166,8 @@ static switch_status_t load_config(void)
} }
globals.server = buf; globals.server = buf;
} }
}
}
#endif #endif
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论