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

windows mod_enum fix potential seg

上级 31580d66
...@@ -153,20 +153,20 @@ static switch_status_t load_config(void) ...@@ -153,20 +153,20 @@ 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);
RegQueryValueEx(hKey, "DhcpNameServer", NULL, NULL, NULL, &data_sz); if (hKey) {
if (globals.server) { RegQueryValueEx(hKey, "DhcpNameServer", NULL, NULL, NULL, &data_sz);
free(globals.server); if (data_sz) {
} buf = (char*)malloc(data_sz + 1);
buf = (char*)malloc(data_sz + 1);
RegQueryValueEx(hKey, "DhcpNameServer", NULL, NULL, (LPBYTE)buf, &data_sz);
RegCloseKey(hKey); RegQueryValueEx(hKey, "DhcpNameServer", NULL, NULL, (LPBYTE)buf, &data_sz);
RegCloseKey(hKey);
if(buf[data_sz - 1] != 0) { if(buf[data_sz - 1] != 0) {
buf[data_sz] = 0; buf[data_sz] = 0;
}
globals.server = buf;
}
} }
globals.server = buf;
} }
#endif #endif
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论