From 67ac88717885a75ded4d5d6f1066e2e257b2e73e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Tue, 3 Jul 2012 18:26:08 +0000 Subject: [PATCH] specify proper length of strings (GGUS #82746) (backport from branch_3_2) --- org.glite.lbjp-common.gss/src/glite_gss.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/org.glite.lbjp-common.gss/src/glite_gss.c b/org.glite.lbjp-common.gss/src/glite_gss.c index e37e4f8..cb94b2c 100644 --- a/org.glite.lbjp-common.gss/src/glite_gss.c +++ b/org.glite.lbjp-common.gss/src/glite_gss.c @@ -559,13 +559,13 @@ edg_wll_gss_acquire_cred_gsi(const char *cert_file, const char *key_file, edg_wl goto end; } - asprintf((char**)&buffer.value, "X509_USER_PROXY=%s", proxy_file); - if (buffer.value == NULL) { + ret = asprintf((char**)&buffer.value, "X509_USER_PROXY=%s", proxy_file); + if (ret == -1) { errno = ENOMEM; ret = EDG_WLL_GSS_ERROR_ERRNO; goto end; } - buffer.length = strlen(proxy_file); + buffer.length = ret; major_status = gss_import_cred(&minor_status, &gss_cred, GSS_C_NO_OID, 1, &buffer, 0, NULL); @@ -734,8 +734,8 @@ static int try_conn_and_auth (edg_wll_GssCred cred, char const *hostname, char * return ret; /* XXX find appropriate fqdn */ - asprintf (&servername, "host@%s", hostname); - if (servername == NULL) { + ret = asprintf (&servername, "host@%s", hostname); + if (ret == -1) { errno = ENOMEM; ret = EDG_WLL_GSS_ERROR_ERRNO; goto end; -- 1.8.2.3