void *dmalloc( int size, char *name ) { return malloc( size ); }
int read_client_conf(void) {
- /* What a strage dance */
+ /* What a strange dance */
struct client_config *config;
char ComputerName [MAX_COMPUTERNAME_LENGTH + 1];
LPSTR lpCompName;
GetComputerName(ComputerName, & ComputerNameSize);
+ debug("Hostname: %s, length: %lu",
+ ComputerName, ComputerNameSize);
/* This never gets freed since it's only called once */
lpCompName =
- HeapAlloc(GetProcessHeap(), 0, strlen(ComputerName) + 1);
+ HeapAlloc(GetProcessHeap(), 0, ComputerNameSize + 1);
if (lpCompName !=NULL) {
- GetComputerName(lpCompName, & ComputerNameSize);
+ memcpy(lpCompName, ComputerName, ComputerNameSize + 1);
/* Send our hostname, some dhcpds use this to update DNS */
config->send_options[DHO_HOST_NAME].data = (u_int8_t*)strlwr(lpCompName);
- config->send_options[DHO_HOST_NAME].len = strlen(ComputerName);
+ config->send_options[DHO_HOST_NAME].len = ComputerNameSize;
debug("Hostname: %s, length: %d",
config->send_options[DHO_HOST_NAME].data,
config->send_options[DHO_HOST_NAME].len);