aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/https/x509/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/https/x509/common.c')
-rw-r--r--src/daemon/https/x509/common.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/src/daemon/https/x509/common.c b/src/daemon/https/x509/common.c
index ca2e355f..1d9c60c7 100644
--- a/src/daemon/https/x509/common.c
+++ b/src/daemon/https/x509/common.c
@@ -410,39 +410,33 @@ MHD__gnutls_x509_data2hex (const opaque * data,
410{ 410{
411 char *res; 411 char *res;
412 char escaped[MAX_STRING_LEN]; 412 char escaped[MAX_STRING_LEN];
413 unsigned int size;
413 414
414 if (2 * data_size + 1 > MAX_STRING_LEN) 415 if (2 * data_size + 1 > MAX_STRING_LEN)
415 { 416 {
416 MHD_gnutls_assert (); 417 MHD_gnutls_assert ();
417 return GNUTLS_E_INTERNAL_ERROR; 418 return GNUTLS_E_INTERNAL_ERROR;
418 } 419 }
419
420 res = MHD_gtls_bin2hex (data, data_size, escaped, sizeof (escaped)); 420 res = MHD_gtls_bin2hex (data, data_size, escaped, sizeof (escaped));
421 421 if (!res)
422 if (res)
423 {
424 unsigned int size = strlen (res) + 1;
425 if (size + 1 > *sizeof_out)
426 {
427 *sizeof_out = size;
428 return GNUTLS_E_SHORT_MEMORY_BUFFER;
429 }
430 *sizeof_out = size; /* -1 for the null +1 for the '#' */
431
432 if (out)
433 {
434 strcpy ((char *) out, "#");
435 strcat ((char *) out, res);
436 }
437
438 return 0;
439 }
440 else
441 { 422 {
442 MHD_gnutls_assert (); 423 MHD_gnutls_assert ();
443 return GNUTLS_E_INTERNAL_ERROR; 424 return GNUTLS_E_INTERNAL_ERROR;
444 } 425 }
445 426
427 size = strlen (res) + 1;
428 if (size + 1 > *sizeof_out)
429 {
430 *sizeof_out = size;
431 return GNUTLS_E_SHORT_MEMORY_BUFFER;
432 }
433 *sizeof_out = size; /* -1 for the null +1 for the '#' */
434
435 if (out)
436 {
437 strcpy ((char*) out, "#");
438 strcat ((char*) out, res);
439 }
446 return 0; 440 return 0;
447} 441}
448 442