246 |
rdp_in_unistr(STREAM s, char *string, int str_size, int in_len) |
rdp_in_unistr(STREAM s, char *string, int str_size, int in_len) |
247 |
{ |
{ |
248 |
#ifdef HAVE_ICONV |
#ifdef HAVE_ICONV |
249 |
size_t ibl = in_len, obl = str_size-1; |
size_t ibl = in_len, obl = str_size - 1; |
250 |
char *pin = (char *) s->p, *pout = string; |
char *pin = (char *) s->p, *pout = string; |
251 |
static iconv_t iconv_h = (iconv_t) - 1; |
static iconv_t iconv_h = (iconv_t) - 1; |
252 |
|
|
291 |
#endif |
#endif |
292 |
{ |
{ |
293 |
int i = 0; |
int i = 0; |
294 |
int len = in_len/2; |
int len = in_len / 2; |
295 |
int rem = 0; |
int rem = 0; |
296 |
|
|
297 |
if (len > str_size-1) |
if (len > str_size - 1) |
298 |
{ |
{ |
299 |
warning("server sent an unexpectedly long string, truncating\n"); |
warning("server sent an unexpectedly long string, truncating\n"); |
300 |
len = str_size-1; |
len = str_size - 1; |
301 |
rem = in_len - 2*len; |
rem = in_len - 2 * len; |
302 |
} |
} |
303 |
|
|
304 |
while (i < len) |
while (i < len) |
1350 |
in_uint32_le(s, len); |
in_uint32_le(s, len); |
1351 |
|
|
1352 |
/* read cookie string (plain ASCII) */ |
/* read cookie string (plain ASCII) */ |
1353 |
if (len > sizeof(g_redirect_cookie)-1) |
if (len > sizeof(g_redirect_cookie) - 1) |
1354 |
{ |
{ |
1355 |
uint32 rem = len - (sizeof(g_redirect_cookie)-1); |
uint32 rem = len - (sizeof(g_redirect_cookie) - 1); |
1356 |
len = sizeof(g_redirect_cookie)-1; |
len = sizeof(g_redirect_cookie) - 1; |
1357 |
|
|
1358 |
warning("Unexpectedly large redirection cookie\n"); |
warning("Unexpectedly large redirection cookie\n"); |
1359 |
in_uint8a(s, g_redirect_cookie, len); |
in_uint8a(s, g_redirect_cookie, len); |