Fix client_hostname

This commit is contained in:
christophe grosjean 2012-05-15 15:33:19 +02:00
parent 39158785a6
commit 15ad1f2589
3 changed files with 6 additions and 5 deletions

View File

@ -488,7 +488,8 @@ boolean gcc_read_client_core_data(STREAM* s, rdpSettings* settings, uint16 block
/* clientName (32 bytes, null-terminated unicode, truncated to 15 characters) */
str = freerdp_uniconv_in(settings->uniconv, stream_get_tail(s), 32);
stream_seek(s, 32);
snprintf(settings->client_hostname, sizeof(settings->client_hostname), "%s", str);
snprintf(settings->client_hostname, 31, "%s", str);
settings->client_hostname[31] = 0;
xfree(str);
stream_read_uint32(s, settings->kbd_type); /* keyboardType */
@ -1208,4 +1209,3 @@ void gcc_write_client_monitor_data(STREAM* s, rdpSettings* settings)
}
}
}

View File

@ -174,7 +174,8 @@ rdpSettings* settings_new(void* instance)
settings->frame_acknowledge = 2;
settings->uniconv = freerdp_uniconv_new();
gethostname(settings->client_hostname, sizeof(settings->client_hostname) - 1);
gethostname(settings->client_hostname, 31);
settings->client_hostname[31] = 0;
settings->mouse_motion = true;
settings->client_auto_reconnect_cookie = xnew(ARC_CS_PRIVATE_PACKET);

View File

@ -266,8 +266,8 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv,
printf("missing client hostname\n");
return FREERDP_ARGS_PARSE_FAILURE;
}
strncpy(settings->client_hostname, argv[index], sizeof(settings->client_hostname) - 1);
settings->client_hostname[sizeof(settings->client_hostname) - 1] = 0;
strncpy(settings->client_hostname, argv[index], 31);
settings->client_hostname[31] = 0;
}
else if (strcmp("-o", argv[index]) == 0)
{