Changeset 49445 in vbox for trunk/src/VBox
- Timestamp:
- Nov 12, 2013 8:49:26 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/win/HostDnsServiceWin.cpp
r49444 r49445 57 57 do { 58 58 CHAR keyName[256]; 59 DWORD cbKeyName = 256;59 DWORD cbKeyName = sizeof(keyName); 60 60 DWORD keyType = 0; 61 61 BYTE keyData[1024]; 62 DWORD cbKeyData = 1024;62 DWORD cbKeyData = sizeof(keyData); 63 63 64 64 hrc = RegEnumValueA(g_hKeyTcpipParameters, regIndex, keyName, &cbKeyName, 0, … … 69 69 if ( RTStrICmp("Domain", keyName) == 0 70 70 && cbKeyData > 1 71 && cbKeyData < 256)71 && cbKeyData < sizeof(abDomain)) 72 72 memcpy(abDomain, keyData, cbKeyData); 73 73 … … 75 75 && cbKeyData > 1 76 76 && abDomain[0] == 0 77 && cbKeyData < 256)77 && cbKeyData < sizeof(abDomain)) 78 78 memcpy(abDomain, keyData, cbKeyData); 79 79 80 80 else if ( RTStrICmp("NameServer", keyName) == 0 81 81 && cbKeyData > 1 82 && cbKeyData < 256)82 && cbKeyData < sizeof(abNameServers)) 83 83 memcpy(abNameServers, keyData, cbKeyData); 84 84 … … 86 86 && cbKeyData > 1 87 87 && abNameServers[0] == 0 88 && cbKeyData < 256)88 && cbKeyData < sizeof(abNameServers)) 89 89 memcpy(abNameServers, keyData, cbKeyData); 90 90 91 91 else if ( RTStrICmp("SearchList", keyName) == 0 92 92 && cbKeyData > 1 93 && cbKeyData < 256)93 && cbKeyData < sizeof(abSearchList)) 94 94 memcpy(abSearchList, keyData, cbKeyData); 95 95 } … … 130 130 131 131 if (next) 132 strncpy(address, current, next - current);132 strncpy(address, current, RT_MIN(sizeof(address)-1, next - current)); 133 133 else 134 134 strcpy(address, current);
Note:
See TracChangeset
for help on using the changeset viewer.